<!DOCTYPE?HTML>
<html>
<head>
????<meta?http-equiv="Content-Type"?content="text/html;?charset=utf-8">
????<title>定時器</title>
????<script?type="text/javascript">
????????var?i;
????????function?start(){
????????????var?time=new?Date();
????????????var?attime=?time.getHours()?+?":"?+?time.getMinutes()?+?":"?+?time.getSeconds();
????????????document.getElementById('clock').value?=?attime;
????????????i?=?setInterval(start,1000);
????????}
????????function?stop()?{
????????????clearInterval(i);
????????}
????</script>
</head>
<body>
<form>
????<input?type="text"?id="clock"?size="50"??/>
????<input?type="button"?value="Start"?onclick="start()">
????<input?type="button"?value?=?"Stop"?onclick?=?"stop()"?/>
</form>
</body>
</html>
2020-02-22
定時器移出start函數
2020-01-15