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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

下面是我的代碼,為什么start和stop兩個(gè)按鈕不管用哎

<!DOCTYPE HTML>

<html>

<head>

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

<title>計(jì)時(shí)器</title>


<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>


正在回答

5 回答

沒(méi)有問(wèn)題啊? 慕課網(wǎng)網(wǎng)頁(yè)問(wèn)題吧

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

錯(cuò)誤如下:

https://img1.sycdn.imooc.com//5bfe7a95000159be14581078.jpg

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

我的代碼:


<!DOCTYPE HTML>

<html>

<head>

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

<title>計(jì)時(shí)器</title>


<script type="text/javascript">

? var num=0,i;

? function startCount() {

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

? ? ? num++;

? ? ? 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ù)我~

你這個(gè)代碼不會(huì)點(diǎn)擊觸發(fā)函數(shù)。而是直接觸發(fā),因?yàn)槟阍趕tartCount()下面又加了一個(gè)setTimeout("startCount()",1000);這樣的定時(shí)器,所以它會(huì)隔1秒后直接執(zhí)行你上面的這個(gè)startCount()函數(shù),

所以你點(diǎn)擊開(kāi)始是沒(méi)用的,但是你點(diǎn)擊停止有用,然后再點(diǎn)擊開(kāi)始也是可以的

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

https://img1.sycdn.imooc.com//5bfa0916000115e500800062.jpg首先C應(yīng)該是小寫(xiě)

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

舉報(bào)

0/150
提交
取消
JavaScript進(jìn)階篇
  • 參與學(xué)習(xí)       468765    人
  • 解答問(wèn)題       22442    個(gè)

本課程從如何插入JS代碼開(kāi)始,帶您進(jìn)入網(wǎng)頁(yè)動(dòng)態(tài)交互世界

進(jìn)入課程

下面是我的代碼,為什么start和stop兩個(gè)按鈕不管用哎

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

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

幫助反饋 APP下載

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

公眾號(hào)

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