倒计时代码
<!DOCTYPE html>
<html>
<head>
<title>浏览器对象</title>
<meta http-equiv="Content-Type" content="text/html; charset=gkb"/>
</head>
<body>
<!--先编写好网页布局-->
<h2>操作成功</h2>
<span id="dao"></span><span>秒后回到主页<span><a href="javascript.history.back()">返回</a>
<script type="text/javascript">
var m=5;
function mytime(){
document.getElementById("dao").innerHTML=m;
m--
setTimeout("mytime()",1000)
if(m==0){ //注意这里有问题2!!!
clearTimeout("mytime()")
window.open("")
}}
setTimeout("mytime()",1000);
</script>
</body>
</html>这个倒计数怎么停不下来,过了0往负无穷大数。
代码有注释那行,m==0改成m=0后,直接从5变成0秒,然后停止。求大牛指点