同意倒计时

<body>
<form>
<input type="submit" id="a" value="同意(10)" disabled="disabled" />
</form>
</body>
</html>
<script>

n=10;
a=document.getElementById("a");
function b(){
n--;
if(n==0){
a.removeAttribute("disabled");
a.value="同意";
// return;
}
else{
a.value="同意("+n+")";
window.setTimeout(b,1000);
}
}
window.setTimeout(b,1000);

</script>

posted on 2017-09-28 15:52  段了的弦  阅读(155)  评论(0编辑  收藏  举报