zoukankan      html  css  js  c++  java
  • 登录框(用获取value值方法)

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <title></title>
            <style type="text/css">
                input{
                     240px;
                    height: 30px;
                    margin-top: 10px;
                }
                .right{
                    text-align: right;
                }
            </style>
            <script>
                function check(){
                    var phone = document.getElementById("phone").value;
                    var pwd = document.getElementById("pwd").value;
                    var qr_pwd = document.getElementById("qr_pwd").value;
                    var nb = document.getElementById("nb").value;
                    
                    if(phone==null || phone==""){
                        document.getElementById("span_phone").innerHTML="*登录名不能为空!";
                        return;
                    }else{
                        document.getElementById("span_phone").innerHTML="<font style='color: green;'>√正确</font>";
                    }
                    if(pwd==null || pwd==""){
                        document.getElementById("span_pwd").innerHTML="*密码不能为空!";
                        return;
                    }else{
                        document.getElementById("span_pwd").innerHTML="<font style='color: green;'>√正确</font>";
                    }
                    if(qr_pwd==null || qr_pwd==""){
                        document.getElementById("span_qr_pwd").innerHTML="*确认密码不能为空!";
                        return;
                    }else{
                        document.getElementById("span_qr_pwd").innerHTML="<font style='color: green;'>√正确</font>";
                    }
                    if(qr_pwd!=pwd){
                        document.getElementById("span_qr_pwd").innerHTML="*确认密码和密码不一致!";
                        return;
                    }else{
                        document.getElementById("span_qr_pwd").innerHTML="<font style='color: green;'>√正确</font>";
                    }
                    if(nb==null || nb==""){
                        document.getElementById("span_nb").innerHTML="*验证码不能为空!";
                        return;
                    }else{
                        document.getElementById("span_nb").innerHTML="<font style='color: green;'>√正确</font>";
                    }
                    
                    //提交表单
                    document.getElementById("f2").submit();
                }
            </script>
        </head>
        <body>
            <center>
          //注意:method="post"时Hbuilder可能会出现"内部服务器错误"提示字样!WebStrom则不会出现此问题。
          //也可将method="post"改为method="get"解决此问题
          //action="跳转的html文件"

    <form id="f2" action="demo1.html" method="post"> <table style="border: 1px;"> <tr> <td class="right">登录名:</td> <td><input id="phone" type="text"/></td> <td><span id="span_phone" style="color: red;"></span></td> </tr> <tr> <td class="right">密码:</td> <td><input id="pwd" type="text"/></td> <td><span id="span_pwd" style="color: red;"></span></td> </tr> <tr> <td class="right">确认密码:</td> <td><input id="qr_pwd" type="text"/></td> <td><span id="span_qr_pwd" style="color: red;"></span></td> </tr> <tr> <td class="right">验证码:</td> <td><input id="nb" type="text"/></td> <td><span id="span_nb" style="color: red;"></span></td> </tr> <tr> <td colspan="3" style="text-align: center;"> <input type="button" onclick="check()" value="提交" style=" 60px;;"/> </td> </tr> </table> </form> </center> </body> </html>

     

  • 相关阅读:
    thinkphp5整合 gatewaywork实现聊天
    php输出日志
    php的ob函数实现页面静态化
    30个php操作redis常用方法代码例子
    redis三种启动方式
    Redis实战
    支付宝即时到账接口开发
    PHP生成excel表格文件并下载
    微信平台提供三种公众号
    【Performance】chrome调试面板
  • 原文地址:https://www.cnblogs.com/jihongtao/p/10034613.html
Copyright © 2011-2022 走看看