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

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

求大神解答。。。實在不知道錯哪里了。??蘖?/h1>

?<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Document</title>

<style type="text/css">

*{margin:0;padding: 0}

ul li{width: 200px;height: 100px;background-color: red;margin-bottom: 10px;border: 4px solid #000}

ul li{list-style: none;}

</style>

</head>

<body>

<ul>

<li></li>

<li></li>

<li></li>

</ul>

</body>

<script type="text/javascript">

window.onload=function(){

var aLi=document.getElementsByTagName('li');

for(var i=0;i<aLi.length;i++){

aLi[i].timer=null;

aLi[i].onmouseover=function(){

moveto(this,400);//讓寬到300

}

aLi[i].onmouseout=function(){

moveto(this,200);

}

}

}


function getStyle(obj,style){

? if(obj.currentStyle){

? ? return obj.currentStyle[style];

? ? }

? else{

? ? return getComputedStyle(obj,false)[style];

? ? }

}

function moveto(obj,itarget){

clearInterval(obj.timer);

obj.timer=setInterval(function(){

var icur=parseInt(getStyle(obj,'width'));

var speed=(itarget-icur)/8;

speed=speed>0?Math.ceil(speed):Math.floor(speed);

if(icur==itarget){

clearInterval(obj.timer);

}

else{

obj.style.width=icur+speed+'px'

//console.log(icur+' ,'+speed+' ,'+obj.style.width);

}

},30)

}


</script>

</html>


正在回答

4 回答

沒有問題,我自己的問題。。。瀏覽器縮放了。。謝謝大家了。。不知道誰動我電腦了

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

有一句沒有加分號obj.style.width=icur+speed+'px',只是看了一下,沒有運行

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

哪里有問題?沒看出來啊

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

出現了什么問題???

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

舉報

0/150
提交
取消

求大神解答。。。實在不知道錯哪里了。??蘖?/h1> 我要回答 關注問題

微信客服

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

幫助反饋 APP下載

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

公眾號

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