计时点击按钮

<p><span id="shu">10</span><input id="anjian" type="button" value="a" disabled="disabled" /></p>
<script type="text/javascript">// <![CDATA[
window.setTimeout("Zhu()",1000)
function Zhu()

{
var s =document.getElementById("shu");
if(parseInt(s.innerHTML)<=0)
{
document.getElementById("anjian").removeAttribute("disabled");
}
else
{
s.innerHTML=parseInt(s.innerHTML)-1
window.setTimeout("Zhu()",1000)
}
}
// ]]></script>

 

posted @ 2018-04-08 10:01  k丶灵  阅读(109)  评论(0编辑  收藏  举报