郑丹丹1990 发表于 2013-4-10 12:51
js视频中这个讲解,你可以参考下! - <!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 type="text/javascript">
- var leftSeconds = 10;
- var intervalId;
- function CountDown() {
- var btnReg = document.getElementById("btnReg");
- if (btnReg) {
- if (leftSeconds <= 0) {
- btnReg.value = "同意";
- btnReg.disabled = "";
- clearInterval(intervalId);
- }
- else {
- btnReg.value = "请仔细阅读协议(还剩" + leftSeconds + "秒)";
- leftSeconds--;
- }
- }
- // intervalId = setInterval("CountDown()", 1000);
- }
- setInterval("CountDown()", 1000);
- </script>
- </head>
- <body >
- <textarea></textarea>
- <input id="btnReg" type="button" value="同意" disabled="disabled" />
- </body>
- </html>
复制代码 |