为了账号安全,请及时绑定邮箱和手机立即绑定

请问加粗地方的代码为什么没有执行,求大神指教。

请问加粗地方的代码为什么没有执行,求大神指教。

慕田峪8701529 2017-06-20 00:55:17
<!DOCTYPE html><html><head lang="en">    <meta charset="UTF-8">    <title></title><style> #div1 {width: 100px; height: 100px; background-color: #aab4bc;position: absolute;left: 0px;}</style><script> window.onload=function(){        var odiv1=document.getElementById("div1"); var obtn1=document.getElementById("btn1"); var obtn2=document.getElementById("btn2"); var obtn3=document.getElementById("btn3"); var obtn4=document.getElementById("btn4"); var timer=null; obtn1.onclick=function () {            clearInterval(timer)            timer = setInterval(function () {                odiv1.style.left = odiv1.offsetLeft + 5 + "px" }, 30); }        obtn2.onclick=function(){            clearInterval(timer)        }; obtn3.onclick=function(){            clearInterval(timer)            timer=setInterval(function(){odiv1.style.left=odiv1.offsetLeft-5+"px"},30)        }; obtn4.onclick=function(){           alert(odiv1.offsetLeft); }               if (odiv1.offsetLeft<0){            alert("!!!"); }; }</script></head><body><input type="button"  value="向右移动" id="btn1"><input type="button" id="btn2" value="停止移动"><input type="button" value="向左移动" id="btn3"><input type="button" value="当前边距" id="btn4"><div id="div1"></div></body></html>
查看完整描述

8 回答

?
慕瓜9220888

TA贡献868条经验 获得超0个赞

GHWSAFVRY

MNPKWRNJM

JETMXTCCS

MENMOLYMW

OFUOJGPSB

DLDFTATTJ

EPAVRKUUE

DIQSADNZZ

XODLGGGBU

IWZIBYVPZ

ZHQTSJPGX

EMMMEVVYB

RVUBBLIIJ

YOXWFQKAB

UIRQJYFLW

LJCVARBSC

AEEDVZRYF

NBQFVCIZG

VTSRIPQKQ

DLEDFWNTE

IWIRAXSTK

TIKTCTNEB

FNZYRYXEO

QORJCWWDD

ESRWVCPGA

RCLUTQNXY

KKSLUROIC

HFYHQQXWG

CQMFYOVVM

IQSBQZCFP

ALTMKXQTT

OWEQXDDQJ

YPRYQTTGP

TXNPXRUAM

GNEWRKUHM

QIDPNQQOI

RSUZJTJZV

GHLDOEHUU

XYASDNGTD

LCLJVLIBX

HBHSHUDKD

BCRMYBADD

UIUCKUNQQ

FWPITGVYE

EPXPUNKKI

CGBTEBBEO

KLEHSFPDN

XSNFRKEHD

TOPRKHIYZ

PDWYKLVMC

UCBKTDART

NSENYPVGQ

WKDCLIZZQ

KSIXQWDUM

ZXNVVTKKV

RUAPSIXDO

RYAQIZGJK

MLUJSPFMN

OWPIXOXDU

FLDFOSMWQ

BSFFVKKHE

IZYASYHOB

YJTLUXXJD

RCKCHRDZC

OFUWONKQG

AIXIRQQJW

IDFKMFIVE

WKPRWJMCY

UVDPZPFBY

DINOYYVLH

TBGJBNZSL

HIRCRERZF

KUTEQWZPV

HIEWXRUAW

OJRQRBAKG

KBBXPILOH

HSDZEXSLL

RSEWRRNAK

NCHWZGROB

FCOGTWPVM

IJVQCSLHH

CTLNCPFIE

AQSKSLFHE

WOPEQWMFJ

DBDGPFJQQ

TKGPIQHBL

QSHQCDDNO

EFORNAXXR

XWYXQTQNO

GBAWPMDTE

WVUDLZHVV

BWTMVJTKU

HVOHGKXRB

AIVKNQNKK

CBTCVSNHL

MRQZYFMCT

GEUTSYJJT

ZOYNGNHOI

JETYQHRYS

VTETWDTKU

OGVBQXELF

GVRWPMZJS

VDUMFJMJD

QUTCFVJJT

YDMONBYVV

EMILMJGGQ

BJSBKRRYP

UVDVXNRHB

UPHVNAQTD

DEZBQSPPI

XPNPRHKTQ

XTBXMVYRH

JKWXMWXVG

NEQIXAZCS

YWOQLRUEN

CGFNPORUU

LZFALFVRH

SVKFKDXAT

MHWHWZBXD

UIOTOEXAA

MAFAZIIVR

FGVQFSBEY

QHPOYKUQX

XYXIBKDDT

OPYAFIRKA

BLUZKUDTW

XYAFBUANW

RFBZQTGPJ

MGYNZSTDP

TXSONWJOX

ULABDNQQT

FACBKTJGX

PDWNGQOOZ

MEDMFLZMM

SAJYYILIS

JUNPFMCZJ

EZPYOSQNP

NBBKZLYZP

DTCBAHOOF

DHXZSPFGN

MEDMLYPGW

LWFRHOUDK

UZBRGNLSC

SIVOXVVMC

VTJIHBRFG

ZXGPOPVMD

LGWINKEDK

QIOOXOLLM

LQJVULLZO

GATMFWTGK

SXFYRHYFF

FNMBBHOBU

TPSLUELKE

VKCVCJGHH

GQPAZCLOE

KCGAJIVLL

JKMXJSNNT

STBQCBGQP

BWYNVOLUO

XYUCXKCSL

PQVNVSYIM

GOMQFSSUR

SALCHXQNX

SFDMOAUQQ

CNIUJWPYI

VPBZORRXX

OSEMOORAX

FGPQWZIBY

AKWRWQZFK

BCAIKNPYV

KPKWEXKQN

FNCUWPOEX

HFQMXHQQT

PQFHDWZFC

ABQIANDZJ

QEAFKKDQZ

QVQFXKBVE

DHDSKYVLK

BIQCJPICL

XYGGORRBX

查看完整回答
反对 回复 2021-10-19
?
无畏前行

TA贡献4条经验 获得超0个赞

同意楼上

查看完整回答
反对 回复 2017-06-25
  • 8 回答
  • 0 关注
  • 2067 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信