Home > Web Front-end > JS Tutorial > js method to implement countdown of user registration agreement

js method to implement countdown of user registration agreement

PHPz
Release: 2018-09-29 16:24:34
Original
1393 people have browsed it

This article mainly introduces the method of implementing the user registration agreement countdown in js. It is a very practical skill when developing member registration functions. Friends who need it can refer to it

The example in this article tells the implementation of the user registration agreement in js. Countdown method. Share it with everyone for your reference. The specific implementation method is as follows:

<html xmlns="http://www.w3.org/1999/xhtml">  
<head>  
    <title>注册</title>  
    <script type="text/javascript">  
        //用户有十秒钟的时间看协议,超过十秒钟,“同意”按钮将生效  
        var Seconds = 10;  
        //计时器ID  
        var setIntervalID;  
        function ok() {  
            var getid = document.getElementById("but");  
            if (Seconds <= 0) {  
                getid.value="同意";  
                getid.disabled = false; //或者写成getid.disabled=""; 启用getid控件。  
                //停止计时器  
                clearInterval(setIntervalID);  
            }  
            else {  
                getid.value = "请仔细阅读协议还剩下【" + Seconds + "】秒"; 
            }  
            Seconds--;  
        }  
      setIntervalID=setInterval("ok()", 1000);  
    </script>  
</head>  
<body>  
<textarea  cols="20" rows="8"></textarea><br />  
<!--disabled="disabled" 默认submit表单是禁用的,也就是只读的,不能点击-->
<input type="submit" id ="but" value="同意" disabled="disabled" />  
</body>  
</html>
Copy after login

The above is the entire content of this chapter. I hope it will be helpful to everyone’s JavaScript programming. For more related tutorials, please visit JavaScript Video Tutorial!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template