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

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

setInerval停止

這個代碼里面的setInterval是怎么停止的。因為沒有clearInterval啊

正在回答

1 回答

<!DOCTYPE?html>
<html>
?<head>
??<title>瀏覽器對象</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>
??<!--先編寫好網頁布局-->
??<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://www.xianlaiwan.cn");
??????????var?clearint=clearInterval(int);
??????}
????}
???var?int=setInterval("showTime()",1000);??

???//通過window的location和history對象來控制網頁的跳轉。
???function?historys(){
????window.history.go(-1);
}
???
?</script>?
</body>
</html>

我寫了這個,主要是這個網址的編輯器不是很好,你可以試一下W3school的編輯器,或者直接寫在html文檔里。

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

舉報

0/150
提交
取消
JavaScript進階篇
  • 參與學習       468972    人
  • 解答問題       22582    個

本課程從如何插入JS代碼開始,帶您進入網頁動態交互世界

進入課程

setInerval停止

我要回答 關注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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