<!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>my運動</title><!-- <link href="運動.css" type="text/css" ?rel="stylesheet"/><script src="運動.js" type="text/javascript"></script> --><style type="text/css">*{?margin:0;?padding:0;font-family:"宋體";}#myblock{width:200px;height:200px;background:#99CC33;position:relative;left:-200px;top:0;}#myblock span{width:50px;height:50px;position:absolute;left:200px;top:150px;background:#9900FF;}</style><script type="text/javascript">function ?mouseOver(L){ var timer=null; clearInterval(timer); var adiv=document.getElementById("myblock"); timer= setInterval(function(){ var v=0; if(adiv.offsetLeft>L){ v=-10; } else{ v=10; } if(adiv.offsetLeft==L){ clearInterval(timer); } else{ adiv.style.left=adiv.offsetLeft+v+'px'; } },30);}</script></head><body> <div id="myblock" ?onmouseover="mouseOver(0)" onmouseout="mouseOver(-200)" > <span >一個</span> </div></body></html>
為什么我的代碼運行起來會不停的閃爍,無法正確運行,求幫助
隔壁諸葛村夫
2016-10-05 20:37:56