求解一段js代码?看不太懂 function css(obj, attr, value)
{
if(arguments.length==2)
{
if(attr!='opacity')
{
return parseInt(obj.currentStyle?obj.currentStyle[attr]:document.defaultView.getComputedStyle(obj, false)[attr]);
}
else
{
return Math.round(100*parseFloat(obj.currentStyle?obj.currentStyle[attr]:document.defaultView.getComputedStyle(obj, false)[attr]));
}
}
else if(arguments.length==3)
switch(attr)
{
case 'width':
case 'height':
case 'paddingLeft':
case 'paddingTop':
case 'paddingRight':
case 'paddingBottom':
value=Math.max(value,0);
case 'left':
case 'top':
case 'marginLeft':
case 'marginTop':
case 'marginRight':
case 'marginBottom':
obj.style[attr]=value+'px';
break;
case 'opacity':
obj.style.filter="alpha(opacity:"+value+")";
obj.style.opacity=value/100;
break;
default:
obj.style[attr]=value;
}
return function (attr_in, value_in){css(obj, attr_in, value_in)};//这个返回函数有什么用?他的参数attr_in,value_in上面都没有啊???
}
var MIAOV_MOVE_TYPE={
BUFFER: 1,
FLEX: 2
};
function miaovStopMove(obj)
{
clearInterval(obj.timer);//这个obj有timer属性吗?这是自己定义的嘛?我没看的过这个属性
}
function miaovStartMove(obj, oTarget, iType, fnCallBack, fnDuring)
{
var fnMove=null;
if(obj.timer)
{
clearInterval(obj.timer);
}
switch(iType)
{
case MIAOV_MOVE_TYPE.BUFFER:
fnMove=miaovDoMoveBuffer;
break;
case MIAOV_MOVE_TYPE.FLEX:
fnMove=miaovDoMoveFlex;
break;
}