题目
麻烦各位帮个忙!
麻烦朋友们帮忙看一下这一段代码:
#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);
};
分享到
鼠标移入时显示效果正常,但是鼠标移出的话,黄色div小块就会不停的左右移动,不能正常缩进-150这个位置.到底是哪里写错了啊?
麻烦朋友们帮忙看一下这一段代码:
#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);
};
分享到
鼠标移入时显示效果正常,但是鼠标移出的话,黄色div小块就会不停的左右移动,不能正常缩进-150这个位置.到底是哪里写错了啊?
提问时间:2021-03-15
答案
上面的timer 到下面就写成了 tiemr 真粗心啊.
举一反三
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
1,人们染上烟瘾,最终因吸烟使自己丧命.
最新试题
- 1今年小李的年龄是他爷爷的1/5,小李发现,12年之后,他的年龄变成了爷爷的1/3,那么今年小李的年龄为_岁.
- 26.5g锌与100g稀硫酸恰好完全反应.(1)在100g稀硫酸中,溶质的化学式为 _ ,其质量为 _ g;溶剂的化学式为 _ ,其质量为 _ g.(2)完全反应后,所得溶液的质量为 _ g.其中溶质的
- 3氧气被人体吸收后去了哪里
- 4the clumpiness index
- 5请解释一道选择题,为什么不选A,C非要选择B呢?谢谢
- 6圆柱形饮料罐底面直径为10厘米,高为15厘米,1平方米的纸最多能包装多少个这样的饮料罐?
- 71.75×53.8-0.537×75-53.7 简便计算
- 8氢气在氧气中燃烧生成水
- 9我为什么而读书(150字)
- 10用一根长64厘米的铁丝,围成一个长6厘米,宽5厘米的长方体教具,这个教具的高最多是多少厘米?
热门考点