10.31

Posted 我是大王哈哈哈

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了10.31相关的知识,希望对你有一定的参考价值。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>login</title>
    <link rel="stylesheet" type="text/css" href="../static/css/10.31.css">
    <script src="../static/js/10.31.js"></script>
</head>
<body>
<div class="hahaha"><h2>欢迎你</h2></div>
<div class="box">
    <h1>登录</h1>
    <div class="input-box">
        账号:<input id="uname" type="text" placeholder="请输入用户名">
    </div>
    <div class="input-box">
        密码:<input id="upass" type="password" placeholder="请输入密码">
    </div>
    <div id="error-box"><br></div>
    <div class="input-box">
        <button onclick="fnLogin()">登录</button>
        <a href="">注册/Resister</a>
    </div>
</div>

</body>
</html>

  

.box{
    width: 400px;
    height: 250px;
    padding-left:100px;
    padding-top:40px;
    background-color:yellow;
}
div.input-box{
    text-align: center;
    height: 33px;
    margin: 5px;
}
#uname{
    width: 180px;
    height: 26px;
}
#upass{
    width: 180px;
    height: 26px;
}
div.input-box button{
    border: 0;
    font-size: 16px;
    width: 118px;
    height: 36px;
    margin-right: 50px;
    background-color: darkgray;
}
div.input-box a{
    font-size: 16px;
    width: 118px;
    height: 36px;
    margin-right: 50px;
}
#error-box{
    font-size: 12px;
    margin: 15px;
}

  

function fnLogin() {
         var oUname = document.getElementById("uname");
         var oError = document.getElementById("error-box");
         var oUpass = document.getElementById("upass");
         var isoError = true;
         oError.innerHTML = "<br>";

         if (oUname.value.length<6||oUname.value.length>20){
              oError.innerHTML="用户名要6-20位";
              isoError = false;
              return;
                }
                else if(oUname.value.charCodeAt(0)>=48&&(oUname.value.charCodeAt(0)<=57)){
             oError.innerHTML = "用户名首字母必须是字母";
             return;
         } else for(var i=0;i<oUname.value.length;i++){
                if((oUname.value.charCodeAt(i)<48||oUname.value.charCodeAt(i)>57)&&(oUname.value.charCodeAt(i)<97||oUname.value.charCodeAt(i)>122)){
                    oError.innerHTML = "用户名必须为字母或数字";
                    return;
                }
         }


          if (oUpass.value.length<6||oUpass.value.length>20){
                    oError.innerHTML="密码至少6-20位";
                     isoError = false;
                      return;

            }
        }

  ____________________________________________________________________________________________________________________________________________________________________________________________________________

注册

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>注册</title>
    <link rel="stylesheet" type="text/css" href="../static/css/注册.css">
    <script src="../static/js/注册.js"></script>
</head>
<body>
<div class="box">
    <h1>注册</h1>
    <div class="input-box">
        账号:<input id="uname" type="text" placeholder="请输入用户名">
    </div>
    <div class="input-box">
        密码:<input id="upass" type="password" placeholder="请输入密码">
    </div>
    <div class="input-box">
        密码:<input id="upass" type="password" placeholder="请再次输入密码">
    </div>
    <div id="error-box"><br></div>
    <div class="input-box">
        <button onclick="fnLogin()">确认注册</button>
    </div>
</div>
</body>
</html>

  

.box{
    width: 400px;
    height: 300px;
    padding-left:100px;
    padding-top:40px;
    background-color:yellow;
}
div.input-box{
    text-align: center;
    height: 33px;
    margin: 5px;
}
#uname{
    width: 180px;
    height: 26px;
}
#upass{
    width: 180px;
    height: 26px;
}
div.input-box button{
    border: 0;
    font-size: 16px;
    width: 118px;
    height: 36px;
    margin-right: 50px;
    background-color: darkgray;
}
div.input-box a{
    font-size: 16px;
    width: 118px;
    height: 36px;
    margin-right: 50px;
}
#error-box{
    font-size: 12px;
    margin: 15px;
}

  

function fnLogin() {
         var oUname = document.getElementById("uname");
         var oError = document.getElementById("error-box");
         var oUpass = document.getElementById("upass");
         var isoError = true;
         oError.innerHTML = "<br>";

         if (oUname.value.length<6||oUname.value.length>20){
              oError.innerHTML="用户名要6-20位";
              isoError = false;
              return;
                }
                else if(oUname.value.charCodeAt(0)>=48&&(oUname.value.charCodeAt(0)<=57)){
             oError.innerHTML = "用户名首字母必须是字母";
             return;
         } else for(var i=0;i<oUname.value.length;i++){
                if((oUname.value.charCodeAt(i)<48||oUname.value.charCodeAt(i)>57)&&(oUname.value.charCodeAt(i)<97||oUname.value.charCodeAt(i)>122)){
                    oError.innerHTML = "用户名必须为字母或数字";
                    return;
                }
         }


          if (oUpass.value.length<6||oUpass.value.length>20){
                    oError.innerHTML="密码至少6-20位";
                     isoError = false;
                      return;

            }
              window.alert("注册成功")
        }

  

以上是关于10.31的主要内容,如果未能解决你的问题,请参考以下文章

10.31

10.31

10.31 总结

10.31

学习笔记10.31

达内 10.31linux基础学习笔记