作业帮 > 综合 > 作业

麻烦各位帮个忙!麻烦朋友们帮忙看一下这一段代码:#div1{width:150px; height:200px; bac

来源:学生作业帮 编辑:百度作业网作业帮 分类:综合作业 时间:2024/06/14 09:52:01
麻烦各位帮个忙!
麻烦朋友们帮忙看一下这一段代码:
#div1{width:150px; height:200px; background:yellow; position:absolute; left:-150px;}
#div1 span{width:20px; height:60px; line-height:20px; background:#F99; position:absolute;right:-20px; top:70px;}
window.onload=function()
{
var oDiv=document.getElementById('div1');
oDiv.onmouseover=function()
{
\x05 startMove(10,0)
}
oDiv.onmouseout=function()
{
\x05 startMove(-10,-150)
}
}
var timer=null;
function startMove(speed,iTarget)
{
var oDiv=document.getElementById('div1');
\x05clearInterval(timer);
\x05tiemr=setInterval(function(){
\x05 if(oDiv.offsetLeft==iTarget)
\x05\x05{
\x05\x05\x05 clearInterval(timer)
\x05\x05}\x05
\x05 else
\x05\x05{
\x05\x05 oDiv.style.left=oDiv.offsetLeft+speed+'px';
\x05\x05};\x05
\x05},30);
};

分享到
麻烦各位帮个忙!麻烦朋友们帮忙看一下这一段代码:#div1{width:150px; height:200px; bac
上面的timer 到下面就写成了 tiemr 真粗心啊.