最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
js实现简单的获取验证码按钮效果
时间:2017-05-18 编辑:简简单单 来源:一聚教程网
效果图:
图(1)初始图
图(2)点击后
代码如下:
代码如下 | 复制代码 |
.checkCode { cursor: pointer; border: 1px solid black; text-align: center; line-height: 26px; width: 115px; height: 35px; } var sleep = 30, interval = null; window.onload = function () { var btn = document.getElementById ('btn'); btn.onclick = function () { if (!interval) { this.style.backgroundColor = 'rgb(243, 182, 182)'; this.disabled = "disabled"; this.style.cursor = "wait"; this.value = "重新发送 (" + sleep-- + ")"; interval = setInterval (function () { if (sleep == 0) { if (!!interval) { clearInterval (interval); interval = null; sleep = 30; btn.style.cursor = "pointer"; btn.removeAttribute ('disabled'); btn.value = "免费获取验证码"; btn.style.backgroundColor = ''; } return false; } btn.value = "重新发送 (" + sleep-- + ")"; }, 1000); } } } |
-
上一个: jQuery获取Table某列的值
-
下一个: js实现二级导航功能
相关文章
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31
- 使用HTML截图并保存为本地图片的代码展示 10-31