亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么不會停止?

<style type="text/css">

#div1{ width:200px; height:200px; background-color:red; position: relative; left:-200px; top:0px;}

#div1 span{ ?display:block; width:20px; height:50px; background-color:blue; position:absolute; left:200px; top:75px;}

</style>

<script>

window.onload=function(){

var oDiv=document.getElementById("div1");

oDiv.onmouseover=function(){

starMove();

}


}

var timer=null;

function starMove()

{

clearInterval(timer);

var oDiv=document.getElementById('div1');

timer = setInterval(function()

{

if(oDiv.offsetLeft == 0)

?{

?window.clearInterval(timer);

?}

else

?{ ?

?oDiv.style.left = oDiv.offsetLeft+1+"px";

?} ?

},30)

}



正在回答

1 回答

<!doctype?html>
<html>
<head>
<meta?charset="utf-8">
<title>無標題文檔</title>
<style?type="text/css">
	*{
		margin:?0;
		padding:?0;
	}/*設置整個文檔的margin和padding*/
#div1{?width:200px;?height:200px;?background-color:red;?position:?relative;?left:-200px;?top:0px;}
#div1?span{??display:block;?width:20px;?height:50px;?background-color:blue;?position:absolute;?left:200px;?top:75px;}
</style>
<script>
window.onload=function(){
var?share=document.getElementById("share");//應該是給share按鈕添加事件
share.onmouseover=function(){
starMove();
}
}
var?timer=null;
function?starMove()
{
clearInterval(timer);
var?oDiv=document.getElementById('div1');
timer?=?setInterval(function()
{
if(oDiv.offsetLeft?==?0)
?{
?window.clearInterval(timer);
?}
else
?{	?
?oDiv.style.left?=?oDiv.offsetLeft+1+"px";
?}??
},30)
}
</script>
</head>

<body>
<div>
??<div?id="div1">
??	<span?id="share">分享</span>
??</div>
</div>
</body>
</html>


0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么不會停止?

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號