我div的节点会出现收不回去的bug,而且还会来回运动<!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"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style type="text/css">div,span,body{ margin:0px; padding:0px; }#div1{width:200px;height:200px;background:#03F;position:relative;left:-200px;top:0px}#div1 span{width:20px;height:50px;background:#CCC;position:absolute;left:200px;top:75px}</style><script type="text/javascript">window.onload=function(){ var D=document.getElementById("div1"); D.onmouseover=function(){ M(0); } D.onmouseout=function(){ M(-200); } function M(T){ var D=document.getElementById("div1"); var timer=null; clearInterval(timer); timer =setInterval(function(){ var s=0; if(T>D.offsetLeft){ s=10; } else{ s=-10; } if(T==D.offsetLeft){ clearInterval(timer); } else{ D.style.left=D.offsetLeft+s+"px"; } },30) }}</script></head><body><div id="div1"><span></span><div></body></html>
添加回答
举报
0/150
提交
取消