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

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

有點(diǎn)Bug。。點(diǎn)了stop后停止,再點(diǎn)2次start后再點(diǎn)stop就停止不了了....

<!DOCTYPE HTML>

<html>

<head>

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

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

<script type="text/javascript">

i=setInterval("clock()",1000);

? ?function clock(){

? ? ? var time=new Date(); ? ? ? ? ? ? ? ?

? ? ? document.getElementById("clock").value = time;

? ?}

? ? ?

function mystart(){

i=setInterval("clock()",1000);

}

? ? function myclear(){

? ? ? ? clearInterval(i);

? ? }

</script>

</head>

<body>

? <form>

? ? <input type="text" id="clock" size="50" ?/>

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

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


? </form>

</body>

</html>


正在回答

2 回答

是的,謝謝樓上的回答~^O^ ? 給我了一個(gè)思路。你這個(gè)代碼運(yùn)行后如果先點(diǎn)一次start后還是停止不了...

下邊是在你基礎(chǔ)上改進(jìn)的:

<!DOCTYPE HTML>

<html>

<head>

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

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

<script type="text/javascript">

var i=setInterval("clock()",1000);

var count = 0;

? ?function clock(){

? ? ? var time=new Date(); ? ? ? ? ? ? ? ?

? ? ? document.getElementById("clock").value = time;

? ? ? console.log(time);

? ?}

? ?function mystart(){

? ? if(count > 0 ){

? ? ? ?i=setInterval("clock()",1000);?

? count--;

? ? }

}

? ? function myclear(){

? ? ? ? clearInterval(i);

? ? ? ? count = 1;

? ? }

</script>

</head>

<body>

? <form>

? ? <input type="text" id="clock" size="50" ?/>

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

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

?

? </form>

</body>

</html>


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

這個(gè)問題是,你點(diǎn)擊了多次開始。想到開啟了多個(gè)定時(shí)器。而你在關(guān)的時(shí)候只關(guān)了一個(gè)。所以會(huì)導(dǎo)致關(guān)不了。

<!DOCTYPE?HTML>
<html>
<head>
<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8">
<title>計(jì)時(shí)器</title>
<script?type="text/javascript">
i=setInterval("clock()",1000);
???function?clock(){
??????var?time=new?Date();????????????????
??????document.getElementById("clock").value?=?time;
??????console.log(time);
???}
?????
?????var?count?=?0;
function?mystart(){
????if(count?==?0){
???????i=setInterval("clock()",1000);?
????}
????count?=?1;
}
????function?myclear(){
????????clearInterval(i);
????????count?=?0;
????}
</script>
</head>
<body>
??<form>
????<input?type="text"?id="clock"?size="50"??/>
????<input?type="button"?value="Stop"?onclick="myclear()"?/>
<input?type="button"?value="Start"?onclick="mystart()"?/>

??</form>
</body>
</html>

這樣是一個(gè)不優(yōu)雅的解決辦法

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

舉報(bào)

0/150
提交
取消

有點(diǎn)Bug。。點(diǎn)了stop后停止,再點(diǎn)2次start后再點(diǎn)stop就停止不了了....

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

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

幫助反饋 APP下載

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

公眾號

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