<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<!--先编写好网页布局-->
<span id="clock"></span>
<script type="text/javascript">
//获取显示秒数的元素,通过定时器来更改秒数。
var x = 10;
var stop;
function times(){
document.getElementById("clock").innerHTML = x ;
x --;
stop = setTimeout('times()',1000);
if(x <=0){
x = 10;
clearTimeout(stop);
}
}
times();
</script>
</body>
</html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<!--先编写好网页布局-->
<span id="clock"></span>
<script type="text/javascript">
//获取显示秒数的元素,通过定时器来更改秒数。
var x = 10;
var stop;
function times(){
document.getElementById("clock").innerHTML = x ;
x --;
stop = setTimeout('times()',1000);
if(x <=0){
x = 10;
clearTimeout(stop);
}
}
times();
</script>
</body>
</html>