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

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

增加了一個(gè)“start”按鈕,如何實(shí)現(xiàn)點(diǎn)擊“start”按鈕后開始計(jì)時(shí),而點(diǎn)擊“stop”按鈕后結(jié)束計(jì)時(shí)呢?下面的代碼實(shí)現(xiàn)不了,只能實(shí)現(xiàn)點(diǎn)擊“stop”結(jié)束計(jì)時(shí),但點(diǎn)擊“start”只跳出一次時(shí)間,而無法繼續(xù)計(jì)時(shí)。。。請(qǐng)高手指點(diǎ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;

? ?function start(){

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

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

// ? ? ?i=setInterval("start()",1000);?

? ?}

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

? ?function stop(){

// ? ?i=setInterval("start()",1000);

? ? ?clearInterval(i);

? ?}

</script>

</head>

<body>

? <form>

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

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

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

? </form>

</body>

</html>


正在回答

5 回答

<!DOCTYPE?html><html>	<head>		<meta?charset="UTF-8">		<title></title>		<style>			html{				font-size:?100px;				text-align:?center;			}			#clock,#stop,#start{				font-size:?1rem;				height:?1rem;				width:?90%;			}		</style>	</head>	<body>		<input?id="clock"?size="50"?type="text"/>		<button?type="button"?onclick="start();"?id="start"?style="font-size:?0.6rem;">開始</button>		<button?type="button"?onclick="stop();"?id="stop"?style="font-size:?0.6rem;">暫停</button>		<script?type="text/javascript">		var?mystr="Hello?World!";		document.write(mystr.substr(-1,6)??+?"<br?/>");		document.write(mystr.substr(0,5)???+?"<br?/>");//		var?int=setInterval(clock,?100)//		function?clock(){//		????var?time=new?Date();//		????document.getElementById("clock").value?=?time;//		}				??var?attime;		??var?timer;		??function?clock(){		????var?time=new?Date();??????????		????attime=time.getHours()+":"+time.getMinutes()+":"+time.getSeconds();		????document.getElementById("clock").value?=?attime;		??}		??timer?=?setInterval(clock,1000);?//注意這里函數(shù)clock?為參數(shù),只寫函數(shù)名		??function?stop(){		??	clearInterval(timer);		??}		??function??start(){		??	timer?=?setInterval(clock,1000);		??}		?		</script>	</body></html>


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">
???????????function?clock(){
?????????????????var?time=new?Date();
?????????????????document.getElementById("clock").value?=?time;
???????????}
???????????var?i;
???????????function?start()?{
???????????	i?=?setInterval("clock()",100);
???????????}
????????</script>
????</head>
????<body>
??????<form>
??????????<input?type="text"?id="clock"?size="50"??/>
??????????<input?type="button"?value="Start"?onclick="start()"?/>
??????????<input?type="button"?value="Stop"?onclick="clearInterval(i)"?/>
??????</form>
????</body>
</html>


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">???function?clock(){??????var?time=new?Date();???????????????	????????document.getElementById("clock").value?=?time;???}???var?i;???function?start()?{	i?=?setInterval("clock()",100);???}????</script></head><body>??<form>????<input?type="text"?id="clock"?size="50"??/>????<input?type="button"?value="Start"?onclick="start()"?/>????<input?type="button"?value="Stop"?onclick="clearInterval(i)"?/>??</form></body></html>


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

你這個(gè)代碼嵌套有問題吧

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

貌似要用到下面講的setTimeout和clearTimeout才可以。

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

? ?function start(){

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

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

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

? ?}

// ? i=setTimeout("start()",1000);

? ?function stop(){

? ? ?clearTimeout(i);

? ?}

</script>

</head>

<body>

? <form>

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

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

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

? </form>

</body>

</html>


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

舉報(bào)

0/150
提交
取消

增加了一個(gè)“start”按鈕,如何實(shí)現(xiàn)點(diǎn)擊“start”按鈕后開始計(jì)時(shí),而點(diǎn)擊“stop”按鈕后結(jié)束計(jì)時(shí)呢?下面的代碼實(shí)現(xiàn)不了,只能實(shí)現(xiàn)點(diǎn)擊“stop”結(jié)束計(jì)時(shí),但點(diǎn)擊“start”只跳出一次時(shí)間,而無法繼續(xù)計(jì)時(shí)。。。請(qǐng)高手指點(diǎn)!謝謝!

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

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

幫助反饋 APP下載

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

公眾號(hào)

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