JQ 模仿注册时等待的时间

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        var times = 10;
        var setIntervalId;
        $(function () {
            $("#btnOk").attr("disabled", true);
            setIntervalId = setInterval("countTimes()", 1000);
        });
        function countTimes() {
            if (times == 0) {
                $("#btnOk").attr("disabled", false);
                $("#btnOk").val("同意");
                clearInterval(setIntervalId);
                return;
            }
            else {

                $("#btnOk").val("请仔细阅读条款" + times + "");
                times--;
            }
        }
    </script>
</head>
<body>
    <textarea>
sdfsdfsdfihoserfidfvg
</textarea>
    <input type="button" value="同意" id="btnOk" />
</body>
</html>

 

posted @ 2014-05-21 22:06  编程猴子  阅读(282)  评论(0编辑  收藏  举报