alpha属性的问题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>js多物体速度动画</title>
<style type="text/css">
*{margin:0;padding:0;}
ul,li{list-style:none}
ul li{width:200px;height:100px;background:#1DF467;margin-bottom:20px}
</style>
<script type="text/javascript">
window.onload=function(){
var oLi=document.getElementsByTagName("li");
for(var i=0;i<oLi.length;i++){
oLi[i].timer=null;
oLi[i].onmouseover=function(){
startMove(this,400);
}
oLi[i].onmouseout=function(){
startMove(this,200);
}
}
}
function startMove(obj,iTarget){
var oLi=document.getElementsByTagName("li");
clearInterval(obj.timer);
obj.timer=setInterval(function(){
var speed=(iTarget-obj.offsetWidth)/10;
speed=speed>0?Math.ceil(speed):Math.floor(speed);
if(obj.offsetWidth==iTarget)
{
clearInterval(obj.timer);
}
else{
obj.style.width=obj.offsetWidth+speed+"px";
}
},30)
}
</script>
</head>
<body>
<ul>
<li></li>
<li></li>
<li></li>
</ul>
</body>
</html>
在window.onload的for循环oDiv[i].alpha中定义了alpha属性,在startMove()函数中就可以直接用吗,不用考虑作用域吗?