<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input type="button" id="downloadbtn" class="meng1an" οnclick='if(timeout>0) {alert("停止计时");return false;}document.location="https://www.baidu.com/"; this.disabled=true;'>
<input type="button" id="downloadbtn1" class="meng1an" οnclick='if(timeout>0) {alert("停止计时00");return false;}document.location="https://www.baidu.com/"; this.disabled=true;' value="暂时">
<script type="text/javascript">
//Js倒计时代码
<!--
var timeout='100';
function countdown()
{
if (timeout <= 0)
{
document.getElementById("downloadbtn").value = '时间到';
if(document.getElementById("downloadfile"))document.getElementById("downloadfile").style.display = '';
}
if (timeout > 0)
{
document.getElementById("downloadbtn").value = '还有 '+timeout+' 秒';
setTimeout('countdown()',1000);
}
timeout--;
}
countdown();
-->
</script>
</body>
</html>
引用:http://www.jquerycn.cn/a_11291