window.document

<title>无标题文档</title>

</head>

<body>
例1:<br />
今年是哪一年?
<input type="text" mima="2016" value="" id="A"/><br />
<input type="button" value="提交" onclick="hs()"/><br />
例2:按钮倒计时,10秒后可以使用。<br />
<input type="submit" value="同意(10)" id="B" disabled="disabled"/>

</body>

</html>
<script>
function hs()
{
var x=document.getElementById("A");
var a1=x.value;
var a2=x.getAttribute("mima");
if(a1==a2)
{alert("答案正确")}
else
alert("答案错误")
}


var x=document.getElementById("B");
var n=10;
function HS()
{
n--;
if(n==0)
{
x.removeAttribute("disabled");
x.value="同意";
return;
}
else
x.value="同意("+n+")"
window.setTimeout("HS()",3000);

}
window.setTimeout("HS()",3000);


</script>

原文地址:https://www.cnblogs.com/wanlibingfeng/p/5323996.html