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

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

想加一個停止倒計(jì)時的按鍵

加了一個停止按鍵? 但是不好使 求大神指教


<!DOCTYPE html>

<html>

?<head>

? <title>瀏覽器對象</title>??

? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>? ?

?</head>

?<body>

? <!--先編寫好網(wǎng)頁布局-->

? <h2>操作成功</h2>

? <span id="count">5</span>秒后回到主頁<a href="javascript" onclick="goBack()">返回</a>

? <a href="javascript" onclick="stopTimeout()">停止倒計(jì)時</a>

? <script type="text/javascript">??


? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。

? ?var num = 5

? ?function startCount() {

? ? document.getElementById('count').innerHTML=num;

? ? num=num-1;

? ? var tt=setTimeout("startCount()",1000) ;

? ? if(num==0){

? ? ? ? clearTimeout(tt);

? ? ? ? window.location.replace("http://idcbgp.cn/");

? ? }

? }

? startCount();

? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。

? ? ?function goBack(){?

? ? ?window.history.go(-1);

? ? }

? ? ?function stopTimeout(){

? ? ? clearTimeout(tt);?

? ? }?


??

?</script>?

</body>

</html>


正在回答

1 回答

自己解決了


<!DOCTYPE html>

<html>

?<head>

? <title>瀏覽器對象</title>??

? <meta http-equiv="Content-Type" content="text/html; charset=gkb"/>? ?

?</head>

?<body>

? <!--先編寫好網(wǎng)頁布局-->

? <h2>操作成功</h2>

? <span id="count">10</span>秒后回到主頁<a href="javascript" onclick="goBack()">返回</a>

? <input type="button" value="stop" onclick="stopCount()">

? <input type="button" value="start" onclick="startCount()">

? <script type="text/javascript">??


? ?//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。

? ?var num = 10;

? ?var tt;

? ?function startCount() {

? ? document.getElementById('count').innerHTML=num;

? ? num=num-1;

? ? tt=setTimeout("startCount()",1000) ;

? ? if(num==0){

? ? ? ? clearTimeout(tt);

? ? ? ? window.location.replace("http://idcbgp.cn/");

? ? }

? }

? startCount();

? ?//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。

? ? ?function goBack(){?

? ? ?window.history.go(-1);

? ? }

? ? ?function stopCount(){

? ? ? clearTimeout(tt);?

? ? }?


??

?</script>?

</body>

</html>


0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

想加一個停止倒計(jì)時的按鍵

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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