• 倒计时、点击移动变色与注册时,JS验证密码是否正确


     <input id="b1" type="button" value="同意(10)" disabled="disabled" />
    
        <script type="text/javascript">
            var t = 10;
    
            var aa = window.setInterval('a()', 1000);
    
            function a() {
                var b = document.getElementById('b1');
                t--;
                if (t == 0) {
                    window.clearInterval(aa);
                    b.value = '同意';
                    b.removeAttribute('disabled');
                    return;
                }
                b.value = '同意(' + t + ')';
            };
        </script>

    倒计时(同意)

     <div>
                <div id="d"></div>
                <asp:Button ID="b1" runat="server" Text="点我变色" />
                &nbsp;&nbsp;
            <asp:Button ID="b2" runat="server" Text="点我移动" />
    
                <script type="text/javascript">
    
                    var list = new Array();
                    list[0] = 'green';
                    list[1] = 'blue';
                    list[2] = 'yellow';
                    list[3] = 'black';
                    list[4] = 'navy';
                    list[5] = '#e0e0e0';
    
                    var num = 0;
    
                    document.getElementById('b1').onclick = function () {
                        document.getElementById('d').style.backgroundColor = list[num];
                        num++;
                        if (num == 6) {
                            num = 0;
                        }
                    };
    
    
                    var timer1 = null;
    
                    document.getElementById('b2').onclick = function () {
                        //document.getElementById('d').style.left = document.getElementById('d').style.offsetleft + 10 + 'px';
                        timer1 = window.setInterval('aaa()', 20);
                    };
    
                    function aaa() {
                        var d = document.getElementById('d');
    
                        d.style.left = d.offsetLeft + 5 + 'px';
    
                        if (d.offsetLeft >= 200) {
                            window.clearInterval(timer1);
                            return;
                        }
                    };
                </script>
            </div>

    点击移动变色

     密    码:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
            <br />
            确认密码:<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
    
            <script type="text/javascript">
                document.getElementById('TextBox1').cnkeyup = function () {
                    var t2 = document.getElementById('TextBox2');
                    if (t.value == t2.value) {
                        alert('正确');
                    }
                    else {
                        alert('错误');
                    }
                };
                document.getElementById('TextBox2').cnkeyup = function () {
                    var t1 = document.getElementById('TextBox1');
                    if (t1.value == t2.value) {
                        alert('正确');
                    }
                    else {
                        alert('错误');
                    }
                };
            </script>

    注册时,JS验证密码是否正确

  • 相关阅读:
    kafka 安装和基本操作
    IPv6表示方法及其简化方法
    Python print输出函数
    同步工具之Vector X
    golang之热加载Fresh&air X
    TOML 1.0格式语法 X
    PHPstorm配置webserver X
    编程辅助工具之Kite X
    golang项目之Makefile X
    高性能消息队列之nsq X
  • 原文地址:https://www.cnblogs.com/123lucy/p/5702237.html
Copyright © 2020-2023  润新知