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

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

js代碼問題求解,按照慕課的寫著怎么就有報錯呢?

彬彬有理_0 2016-10-10 20:42:58
<!doctype html><html><head><meta charset="utf-8"><title> 速度動畫--購物車</title><style>body,div,span{ margin:0; padding:0; }#div1{ width:200px; height:200px; background:red; position:relative; left:-200px; top:0px;}#div1 span{ width:20px; height:50px; background:blue; position:absolute; left:200px; top:75px;}</style></head><body> <div id="div1"><span id="share">分享</span></div><script>window.onload = function(){? var oDiv = document.getElementById('div1'); oDiv.onmouseover = function(){ startMove(); } oDiv.onmouseout = function(){ startMove1(); }}var timer = null;function startMove(){ clearInterval(timer); var oDiv = document.getElementById('div1'); timer = setInterval(function(){ if(oDiv.offsetLeft == 0){ cleraInterval(timer); } else{ oDiv.style.left = oDiv.offsetLeft+1+'px'; } },30) };function startMove1(){ clearInterval(timer); var oDiv = document.getElementById('div1'); timer = setInterval(function(){ if(oDiv.offsetLeft == -200){ cleraInterval(timer); } else{ oDiv.style.left = oDiv.offsetLeft-1+'px'; } },30) }</script></body></html>
查看完整描述

2 回答

已采納
?
LLaaaalei_

TA貢獻5條經驗 獲得超2個贊

嗯呢,倒數第九行的

查看完整回答
反對 回復 2016-10-11
?
stone310

TA貢獻361條經驗 獲得超191個贊

clearInterval拼寫錯了

查看完整回答
1 反對 回復 2016-10-10
  • 2 回答
  • 0 關注
  • 1702 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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