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>
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!