-----------------------------
<html>
<head>
<script type="text/javascript"> var c=0; var t; function timedCount() { c=c+1; <!-- document.getElementById('txt').value=c --> var time=document.getElementById('txt'); time=c.value; t=setTimeout("timedCount()",1000); }</script>
</head>
<body>
<form><input type="button" value="点击按钮开始计数!" onClick="timedCount()"><input type="text" id="txt"></form>
</body>
</html>
把document.getElementById('txt').value=c修改一下就不行了
为什么没人回答,如下代码可以实现:
<html>
<head>
<script language="javascript">
function asd(count,url){
document.getElementById("div1").style.display = "block";
var sp = document.getElementById('sp');
sp.innerHTML = 友敬棚count;
if(--count > 0)
setTimeout("asd("+count+",'"+url+"')", 1000);
else
location.href = url;
}
</script>
</head>
<body>
<input type="button" onclick="asd(5,'稿搏http://www.baidu.com/');" value="点击跳转" />
<div 好则id="div1" style="display:none;"><span id="sp"></span>秒后跳转</div>
</body>
</html>
var t=setTimeout("location.assign(http://网页地址);"陆逗旅,5000); 加上单引号
如:var t=setTimeout("location.assign(’http://网页地址指空‘);"早凳,5000);