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

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

為什么在函數(shù)startCount()外面好要寫 一句 setTimeout("startCount()",1000);

<!DOCTYPE HTML>

<html>

<head>

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

<title>計時器</title>

</head>

<script type="text/javascript">

? var num=0;

? var i;

? function startCount(){

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

? ? num=num+1;

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

? }

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

? function stopCount(){

? clearTimeout(i);

? }

</script>

</head>

<body>

? <form>

? ? <input type="text" id="count" />

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

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

? </form>

</body>

</html>


正在回答

2 回答

如果是慕課的練習(xí)的話,并不需要要那一句話,加了那一句話就會變成自動計時了,與題目要求不符,你可以測試一下加上那句話和不加那句話的不同效果。

<!DOCTYPE HTML>

<html>

<head>

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

<title>計時器</title>

</head>

<script type="text/javascript">

? var num=0;

? var i;

? function startCount(){

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

? ? num=num+1;

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

? }

? function stopCount(){

? clearTimeout(i);

? }

</script>

</head>

<body>

? <form>

? ? <input type="text" id="count" />

? ? <input type="button" value="Start" onClick="startCount()" ?/>

? ? <input type="button" value="Stop" onClick="stopCount()" ? />

? </form>

</body>

</html>


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

慕粉4296528 提問者

非常感謝!
2016-12-09 回復(fù) 有任何疑惑可以回復(fù)我~

因為只是函數(shù)定義,并沒有調(diào)用函數(shù)。

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

舉報

0/150
提交
取消

為什么在函數(shù)startCount()外面好要寫 一句 setTimeout("startCount()",1000);

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

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

幫助反饋 APP下載

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

公眾號

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