// javascript document function startmove(obj,json,endfn){ clearinterval(obj.timer); obj.timer = setinterval(function(){ var bbtn = true; for(var attr in json){ var icur = 0; if(attr == 'opacity'){ if(math.round(parsefloat(getstyle(obj,attr))*100)==0){ icur = math.round(parsefloat(getstyle(obj,attr))*100); } else{ icur = math.round(parsefloat(getstyle(obj,attr))*100) || 100; } } else{ icur = parseint(getstyle(obj,attr)) || 0; } var ispeed = (json[attr] - icur)/8; ispeed = ispeed >0 ? math.ceil(ispeed) : math.floor(ispeed); if(icur!=json[attr]){ bbtn = false; } if(attr == 'opacity'){ obj.style.filter = 'alpha(opacity=' +(icur + ispeed)+ ')'; obj.style.opacity = (icur + ispeed)/100; } else{ obj.style[attr] = icur + ispeed + 'px'; } } if(bbtn){ clearinterval(obj.timer); if(endfn){ endfn.call(obj); } } },30); } function getstyle(obj,attr){ if(obj.currentstyle){ return obj.currentstyle[attr]; } else{ return getcomputedstyle(obj,false)[attr]; } }