課程
/前端開發(fā)
/JavaScript
/JavaScript進(jìn)階篇
這個(gè)代碼里面的setInterval是怎么停止的。因?yàn)闆]有clearInterval啊
2015-05-23
源自:JavaScript進(jìn)階篇 8-17
正在回答
<!DOCTYPE?html> <html> ?<head> ??<title>瀏覽器對(duì)象</title>?? ??<meta?http-equiv="Content-Type"?content="text/html;?charset=gkb"/>??? ??<style> ??????#top{ ??????????width:100%; ??????????height:100px; ??????????background-color:red; ??????????} ????????#container{ ?????????????width:100%; ??????????height:300px; ??????????background-color:blue; ????????} ????????#footer{ ??????????width:100%; ??????????height:100px; ??????????background-color:red; ????????} ??</style> ?</head> ?<body> ??<!--先編寫好網(wǎng)頁布局--> ??<div?id="top"> ?????<p?id="time"></p><a?onclick="?historys()">返回</a>? ????? ??</div> ??<div?id="container"></div> ??<div?id="footer"></div> ??<script?type="text/javascript">? ????var?num=6; ????function?showTime(){ ??????num=num-1; ??????if(num>0){ ?????document.getElementById("time").innerHTML=num; ??????} ???????else{ ??????????location.assign("http://idcbgp.cn"); ??????????var?clearint=clearInterval(int); ??????} ????} ???var?int=setInterval("showTime()",1000);?? ???//通過window的location和history對(duì)象來控制網(wǎng)頁的跳轉(zhuǎn)。 ???function?historys(){ ????window.history.go(-1); } ??? ?</script>? </body> </html>
我寫了這個(gè),主要是這個(gè)網(wǎng)址的編輯器不是很好,你可以試一下W3school的編輯器,或者直接寫在html文檔里。
舉報(bào)
本課程從如何插入JS代碼開始,帶您進(jìn)入網(wǎng)頁動(dòng)態(tài)交互世界
3 回答stop不會(huì)停止
2 回答怎么弄停止后繼續(xù),繼續(xù)后還能停止
3 回答彈窗怎么停止
2 回答為何不能停止
1 回答無法停止按鈕
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2015-05-24
我寫了這個(gè),主要是這個(gè)網(wǎng)址的編輯器不是很好,你可以試一下W3school的編輯器,或者直接寫在html文檔里。