zoukankan      html  css  js  c++  java
  • 倒计时获取手机验证码

    <!DOCTYPE html>
    <html lang="en">
        <head>
    <meta charset="utf-8">
            <style>
                input{
                    outline: none;
                    border: 1px solid #ccc;
                    border-radius: 5px;
                    padding: 5px 10px;
                    background-color: #fff;
                    color: #444;
                }
            </style>
            <script src='common.js'></script>
            <script type="text/javascript">
                window.onload = function(){
                    $id('send').onclick = function(){
                        var count = 5;
                        if(this.timer){
                            clearInterval(this.timer);
                        }
                        var that = this;
                        this.timer = setInterval(function(){
                            that.value = '还剩' + count + '秒';
                            count--;
                            that.style.backgroundColor = 'skyblue';
                            that.style.color = '#fff';
                            that.disabled = true;
                            if(count < 0){
                                clearInterval(that.timer);
                                that.value = '点击重新发送验证码';
                                that.style.backgroundColor = '#fff';
                                that.style.color = '#444';
                                that.disabled = false;
                            }
                        }, 1000);


                    }
                }
            </script>
        </head>
        <body>
            <input type="text" >
            <input type="button" id="send" value="点击获取手机验证码">
        </body>
    </html>
  • 相关阅读:
    Cairngorm的command并不是一直存在,而是触发一次就创建一次command类的实例
    如何利用xml实现换行
    利用ViewStack实现页面的跳转
    让TextArea的垂直滚动条总是滚到对下面
    AS"文本显示和输入"探究
    fps
    简单的按键管理类,使ctrl+enter快捷键起作用
    mc的"animationComplete"事件需要冒泡吗?
    Javascript 利用键盘上的上下左右(回车)键模拟出tab 键的功能上下左右移动焦点
    DataTable操作中的性能问题(转载)
  • 原文地址:https://www.cnblogs.com/mmit/p/11268743.html
Copyright © 2011-2022 走看看