課程
/前端開發(fā)
/JavaScript
/JavaScript進(jìn)階篇
是這里的編譯環(huán)境有問(wèn)題嗎?還是我的代碼不對(duì)
2015-08-13
源自:JavaScript進(jìn)階篇 8-4
正在回答
是編譯環(huán)境的問(wèn)題,這個(gè)在本地使用就好
在本地試試這個(gè)
<!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=setInterval("clock()",100);
function start( )
{
? ?i =setInterval("clock()",100);
}
</script>
</head>
<body>
? <form>
? ? <input type="text" id="clock" size="50" ?/>
? ? <input type="button" value="Stop" onclick="clearInterval(i)" />
<input type="button" value="Start" onclick="start( )" />
? </form>
</body>
</html>
舉報(bào)
本課程從如何插入JS代碼開始,帶您進(jìn)入網(wǎng)頁(yè)動(dòng)態(tài)交互世界
8 回答stop不能停
3 回答stop不會(huì)停止
3 回答stop停不下來(lái)。
2 回答被忽悠了,stop停不下來(lái)??!
2 回答start 一次,stop 是可以停住得,但是連續(xù) start 之后,就 stop 停不住了,怎么回事呢?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2015-08-13
是編譯環(huán)境的問(wèn)題,這個(gè)在本地使用就好
2015-09-17
在本地試試這個(gè)
<!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=setInterval("clock()",100);
function start( )
{
? ?i =setInterval("clock()",100);
}
</script>
</head>
<body>
? <form>
? ? <input type="text" id="clock" size="50" ?/>
? ? <input type="button" value="Stop" onclick="clearInterval(i)" />
<input type="button" value="Start" onclick="start( )" />
? </form>
</body>
</html>