方式一:

方式二:

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>按钮倒计时</title>

</head>

<body>
<p>
<label><input   type="submit"   name="btnSubmit"      />  
</label>
</p>

</body>
<script language="javascript">

var n = 10;//计数器  
//document.all.btnSubmit.disabled = true;
    document.getElementById("btnSubmit").disabled = true;
function btnShow()  
{  
   str = "倒计时...";  
   n--;
   if(n <=   0)  
   {  
    document.getElementById("btnSubmit").value = "提交";  
    document.getElementById("btnSubmit").disabled = false;  
   }  
   else  
   {  
    document.getElementById("btnSubmit").value = str + n +"秒";
   }  
}
    window.setInterval(btnShow,1000);  

</script>
</html>


相关文章:

  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-07
  • 2021-11-17
  • 2022-12-23
  • 2021-07-19
  • 2021-09-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2022-12-23
相关资源
相似解决方案