过一定时间显示可用控件

 

 

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script type="text/javascript">
        var time = 10;//指定要过多长时间
        function tranform()
        {    
            var btnagree = window.document.getElementById("IDagree");
            if (time > 0)
            {//在disabled的情况下继续操作控件,让他显示倒计时
                btnagree.value = "同意(" + time + "s后继续)";
                time--;
            }
            else {
                btnagree.value = "同意";

           //够时间的情况下,要把控件的可用性打开
                btnagree.disabled = false;

//清除时间循环
                clearInterval("timeID");        
            }
        }
        var timeID = setInterval("tranform()", 1000);
    </script>
</head>
<body onload="tranform()">

//开始让控件不可用
    <input id="IDagree" type="button" value="同意" disabled="disabled" />
</body>
</html>

上一篇:spring mvc <mvc:annotation-driven>配置使用出现故障


下一篇:视频监控热成像技术在民用领域的应用