首页 > 代码库 > 一个时间
一个时间
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<input type="button" value="http://www.mamicode.com/开始计时" onclick="timeout"> 分钟
<form name="a">
<input type="text" value="http://www.mamicode.com/0" name="minture"></form>
秒
<form name="b">
<input type="text" value="http://www.mamicode.com/0" name="second"></form>
<input type="button" value="http://www.mamicode.com/停止计时" onclick="stoptime">
</body>
</html>
<script>
var x = -1;
y = -1;
function countMin() {
y=y+1;
var n=y%60;
document.a.minture.value = http://www.mamicode.com/n;
setTimeout("countMin()", 1000 * 60)
}
function countsec() {
x = x + 1;
var z = x % 60
document.b.second.value = http://www.mamicode.com/z;
setTimeout("countsec()", 1000)
}
countMin()
countsec()
</script>
一个时间