functionStartmove (Obj,attr,itart) {//object, attribute, target valueClearinterval (Obj.time);//Note that the timer must be cleared firstObj.time = SetInterval (function () { varicur = 0;//values for the current non-inline style if(attr = = ' opacity ') {//if it's 0.3,Icur = parseint (parsefloat (GetStyle (obj,attr)) *100);//To avoid the occurrence of decimals.}Else{icur= parseint (GetStyle (obj,attr));//take the whole } varspend = (itart-icur)/8;//buffered motion, speed spend = spend>0? Math.ceil (spend): Math.floor (spend);//greater than 0 o'clock rounding up, less than 0 o'clock down rounding if(Icur = = Itart) {//whether to reach the endClearinterval (Obj.time);//after reaching the finish, clear the timer}Else{ if(attr = = ' opacity ') {Obj.style.filter= ' Alpha (opacity: ' + (icur+spend) + ') '; Obj.style.opacity= (icur+spend)/100; document.getElementById ("Txt1"). Value =obj.style.opacity; }Else{obj.style[attr]= icur+spend+ "px";//before you arrive } } },30); }
Multi-Object Motion frame