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

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

為什么我的秒數(shù)只跳了一次

<!DOCTYPE?html>
<html>
?<head>
??<title>瀏覽器對象</title>??
??<meta?http-equiv="Content-Type"?content="text/html;?charset=gkb"/>???
?</head>
?<body>
??<!--先編寫好網(wǎng)頁布局-->
??<h2>操作成功</h2>
??<p><span?id="ctime"?>5</span>回到主頁<a?href="back()">返回<a/></p>
?
??<script?type="text/javascript">?
????var?index?=?window.location.host;
????var?num?=?document.getElementById("ctime").innerHTML;
????function?count(){
????????num?=?num?-?1;
????????document.getElementById("ctime").innerHTML=num;
????????if(num?==?0){
????????location.assign("idcbgp.cn")?;
????????}
????}//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
????setTimeout("count()",1000);
????function?back(){
????????window.history.back()
????}
???//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
???
?</script>?
</body>
</html>


正在回答

4 回答

你要用setInterval() 同學(xué) setTimeout 只會觸發(fā)一次

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

Ticvory 提問者

我是不是把setTimeout();放在函數(shù)內(nèi)就可以完成setInterval();一樣的功能?
2016-11-03 回復(fù) 有任何疑惑可以回復(fù)我~
#2

一直都在路上 回復(fù) Ticvory 提問者

是的 ,記得每次開始前清楚一下上一次的時間
2016-11-03 回復(fù) 有任何疑惑可以回復(fù)我~
#3

一直都在路上 回復(fù) Ticvory 提問者

清除一下,打錯字~clearInterval
2016-11-03 回復(fù) 有任何疑惑可以回復(fù)我~
#4

Ticvory 提問者

非常感謝!
2016-11-10 回復(fù) 有任何疑惑可以回復(fù)我~
查看1條回復(fù)

里面最后加一個setTimeout

0 回復(fù) 有任何疑惑可以回復(fù)我~
<!DOCTYPE?html>
<html>
<head>
	<title>瀏覽器對象</title>
	<meta?http-equiv="Content-Type"?content="text/html;?charset=gkb"?/>
</head>
<body>
	<!--先編寫好網(wǎng)頁布局-->
	<h2>操作成功</h2>
	<p><span?id="ctime"?>5</span>回到主頁<a?href="back()">返回</a></p>

	<script?type="text/javascript">
		var?index?=?window.location.host;
		var?num?=?document.getElementById("ctime").innerHTML;

		function?count()?{
			num?=?num?-?1;
			document.getElementById("ctime").innerHTML?=?num;
			if?(num?==?0)?{
				location.assign("idcbgp.cn");
			}
		}

		//獲取顯示秒數(shù)的元素,通過定時器來更改秒數(shù)。
		//setTimeout不會重復(fù)
		//setTimeout("count()",?1000);

		//SetInterval為自動重復(fù)
		setInterval("count()",?1000);

		//通過window的location和history對象來控制網(wǎng)頁的跳轉(zhuǎn)。
		function?back()?{
			window.history.back()
		}
	</script>
</body>
</html>


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

<!DOCTYPE html>

<html>

?<head>

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

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

?</head>

?<body>

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

? <p>操作成功</p></br>

? <span id="count">5</span>

? ? <p>秒后回到主頁

? ? ? ? <input type="button" value="返回" onclick="goback()">

? ? </p>

? ? </br>

?

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

? ? var num=document.getElementById("count").innerHTML;

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

? ? ?function startCount(){

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

? ? ? ? ?num=num-1;

? ? ? ? ?if(num==0)

? ? ? ? ? ?location.assign("idcbgp.cn");

? ? ? }

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

? ? ? setInterval("startCount()",1000);

? ? ? function goback(){

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

? ? ? }

? ? ??

?</script>?

? ??

</body>

</html>


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

舉報

0/150
提交
取消

為什么我的秒數(shù)只跳了一次

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

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

幫助反饋 APP下載

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

公眾號

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