<!DOCTYPE html>
<html>
<head>
<title>计时器</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
<script>
var x = 0;
var t;
function startTime(){
document.getElementById("txt").value=x;
x=x+1;
t = setTimeout("startTime()",1000);
}
function stopTime(){
clearTimeout(t);
}
</script>
</head>
<body>
<div>
<input type="text" id="txt" />
</div>
<input id="start" name="start" type="button" value="startTime" οnclick="startTime()"/>
<input id="stop" name="stop" type="button" value="stopTime" οnclick="stopTime()"/>
</body>
</html>
JS.简单的计时器
最新推荐文章于 2021-06-15 17:59:06 发布