求助!!!!
鼠标滑过没有任何效果,求告知哪里错了
var a=document.getElementsByTagName("div");
for(var i=0;i<a.length;i++)
{
a[i].onmouseover=function()
{
var _this=this.getElementsByTagName("img")[0];
startMove(_this,{top:-15});
}
}
function startMove(obj,json,f)
{
clearInterval(obj.time);
var flag=true;
obj.time=setInterval(function(){
for(var kind in json)
{
var attribute=parseInt(getStyle(obj,kind));
var speed=(json[kind]-attribute)/10;
speed=speed>0?Math.ceil(speed):Math.floor(speed);
if(attribute!=json[kind])
{
flag=false;
obj.style[kind]=attribute+speed+"px";
}
if(flag)
{
clearInterval(obj.time);
if(f)
f();
}
}
},30);}
function getStyle(obj,attr)
{
if(obj.currentStyle)
return obj.currentStyle[attr];
else
return obj.getComputedStyle(obj,false)[attr];
}