第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

這個JavaScript程序為什么把方塊向右移就可以緩慢移,向左移就很快速?

這個JavaScript程序為什么把方塊向右移就可以緩慢移,向左移就很快速?

<!DOCTYPE?html> <meta?charset="utf-8"> <head> <title></title> <style?type="text/css"> #div1{width:?100px;?height:?100px;?background-color:?red;?position:absolute;?left:?900px;top:?50px;} #div2{width:?1px;height:?300px;background-color:?black;?position:?absolute;?left:?300px;top:?0px;} #div3{width:?1px;height:?300px;background-color:?black;?position:?absolute;?left:?800px;top:?0px;} </style> <script?type="text/javascript"> window.onload?=?function() { var?oDiv1?=?document.getElementById('div1'); var?oBtn1??=?document.getElementById('btn1'); var?oBtn2??=?document.getElementById('btn2'); var?timer?=?null; oBtn1.onclick?=?function() { startMove(300); } oBtn2.onclick?=?function() { startMove(800); } function?startMove(iTarget) { var?oDiv1?=?document.getElementById('div1'); clearInterval(timer); timer=setInterval(function(){ var?speed?=?0; if?(oDiv1.offsetLeft<iTarget)? { speed?=?7; } else { speed?=?-7; } if(Math.abs(iTarget-oDiv1.offsetLeft<=7)) { clearInterval(timer); oDiv1.style.left?=?iTarget+'px'; } else { oDiv1.style.left?=?oDiv1.offsetLeft+speed+'px'; } },30) } } </script> </head> <body> <input?id="btn1"?type="button"?value="到300"?/> <input?id="btn2"?type="button"?value="到800"?/> <div?id="div1"> </div> <div?id="div2"> </div> <div?id="div3"> </div> </body> </html>
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關(guān)注
  • 1745 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號