HTML-答案检查&按钮倒计时

<body>
<span>JS是弱类型语言还是强类型语言?</span>
<input  id="st" type="text" daan="弱类型"/>
<input type="button" onclick="jc()" value="检查"/><br />
<input type="button" id="ty" value="同意(9)" disabled="disabled" />
</body>
<script type="text/javascript">
function jc()
{
    var d = document.getElementById("st");
    var b =d.getAttribute("daan");
    var a = d.value;
    if(b==a)
    {
        alert("恭喜你,答对了!");
    }
    else
    {
        alert("笨蛋,答错了!");
    }
}

var n =9;
function daosjis()
{
    n--;
    var b = document.getElementById("ty");
    if(n==0)
    {
        b.value="同意";
        b.removeAttribute("disabled");
    }
    else
    {
        b.value="同意("+n+")";
        window.setTimeout("daosjis()",1000);
    }   
}
window.setTimeout("daosjis()",1000);

</script>

posted @ 2015-08-31 09:10  断肠人—断肠人  阅读(193)  评论(0编辑  收藏  举报