美文网首页
2019-07-18

2019-07-18

作者: 江河不渡 | 来源:发表于2019-07-18 13:15 被阅读0次

我的简单的登录注册页面练习
1.登录页面

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>登录页面练习</title>
<style>

    body{
        /* background-color: rgb(217, 235, 250); */
        background-image: url(图片1.jpg);

    }
    
    .loginn{
        background-color: white;
        height: 320px;
        width: 240px;
        padding: 25px;
        margin-top: 150px;
        margin-left:60%;
        border-radius: 25px;
        box-shadow:  4px 4px 8px rgba(0, 0, 0,0.5);
    }
    .loginn>p{
        margin-left: 40%;
        margin-top: 10px;
        color:black;
        font-size: 20px;
    }
    
    .LOGB{
        border-collapse: separate;
        border-radius: 15px;
        border: 1px solid rgb(167, 160, 160);
        text-align: right;
        width: 98%;
        height: 40Px;;
        
        
    }
    .LOGD{
        width: 80%;
        height: 35px;
        margin-left: 8%;
        border-radius: 25px; 
        background-color: rgb(160, 207, 192);
        border: 1px solid wheat;
        outline: none;
    }
    .LOGE{
        font-size: 10px;
        margin-left: 30%;
        margin-bottom: 10%;
    }
    .input2{
        outline: none;
        border: 0px; 
        margin-right: 20%;
        
    }

</style>

</head>
<body>

<div class="loginn">
    <p>登录</p>
    <br>
    <form action="">
        <table class="LOGB" cellspacing="0">
            <tr>
                <td>用户名:&nbsp;</td>
                <td><input type="text"  placeholder="姓名" class="input2"></td>
            </tr>
          
        </table>  
        <br>
       <table class="LOGB"  cellspacing="0" > 
            <tr>
                <td>密码: </td>
                <td><input type="password" placeholder="你的密码" class="input2"></td>
            </tr>
        </table> 
        <br>
         <br>
        <div class="LOGD">
            <a href="index.html"><button class="LOGD" >登录</button></a>
        </div>
        <br>
        <div class="LOGE">
            <p>没有账号?<a href="注册.html">立即注册</a></p>
        </div>


    </form>
    
</div>

</body>
</html>

2.注册页面

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>登录页面练习</title>
<style>
body{
background-color: rgb(217, 235, 250);
}

    .loginn{
        background-color: white;
        height: 320px;
        width: 240px;
        padding: 25px;
        margin-top: 150px;
        margin-left:60%;
        border-radius: 25px;
        box-shadow:  4px 4px 8px rgba(0, 0, 0,0.5);
    }
    .loginn>p{
        margin-left: 40%;
        margin-top: 10px;
        color:black;
        font-size: 20px;
    }
    
    .LOGB{
        border-collapse: separate;
        border-radius: 15px;
        border: 1px solid rgb(167, 160, 160);
        text-align: right;
        width: 95%;
        height: 30px;
        
        
    }
    #log1{
        text-align: center;
        width: 180px;
        background-color: rgb(137, 202, 180);
        margin-left: 10%;
        border-radius: 25px;
        outline: none;

    }

    .LOGE{
        font-size: 10px;
        margin-left: 30%;
        margin-bottom: 10%;
    }
    .input2{
        outline: none;
        border: 0px; 
        margin-right: 20%;
        
    }

</style>

</head>
<body>

<div class="loginn">
    <p>注册</p>
    
    <form action="">
        <table class="LOGB" cellspacing="0">
            <tr>
                <td>用户名:&nbsp;</td>
                <td><input type="text"  placeholder="姓名" class="input2"></td>
            </tr>
          
        </table>  
        <br>
       <table class="LOGB"  cellspacing="0" > 
            <tr>
                <td>密码: </td>
                <td><input type="password" placeholder="你的密码" class="input2"></td>
            </tr>
        </table> 
        <br>
         <table class="LOGB"   cellspacing="1">
            <tr>
                <td>+86:</td>
                <td><input type="text" maxlength="11" placeholder="手机号码" class="input2" ></td>
            </tr>
           
        </table>
            <br>
         <table class="LOGB" cellspacing="0"> 
            <tr>
                <td>验证码:</td>
                <td><input type="text" style="border:0"class="input2" ></td>
                
            </tr>
        </table>
        <br>
        <a  href=><button id="log1">注册</button></a>
        <div class="LOGE">
            <p>已有账号?<a href="登录练习.html">立即登录</a></p>
        </div>


    </form>
    
</div>

</body>
</html>

图片.png

这个登录具有错误提示功能

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>登录页面练习</title>
<style>

    body{
        background-color: rgb(217, 235, 250);
    }
    .loginn{
        background-color: white;
        height: 320px;
        width: 240px;
        padding: 25px;
        margin-top: 150px;
        margin-left:60%;
        border-radius: 25px;
        box-shadow:  4px 4px 8px rgba(0, 0, 0,0.5);
    }
    .loginn>p{
        margin-left: 40%;
        margin-top: 10px;
        color:black;
        font-size: 20px;
    }
    .LOGD{
        text-align: center;
        width: 180px;
        background-color: rgb(137, 202, 180);
        margin-left: 10%;
        border-radius: 25px;
        outline: none;

    }
     .LOGE{
        font-size: 10px;

        margin-bottom: 2%;
    }

    .LOGB{
        border-collapse: separate;
        border-radius: 15px;
        border: 1px solid rgb(167, 160, 160);
        width: 95%;
        height: 30px;
    }
    .input1{
        outline: none;
        border: 0px;
    }
</style>

</head>
<body>
<div class="loginn">
<p>登录</p>





<form name="myForm" action="demo_form.php" onsubmit="return validateForm()" method="post">
<div class="LOGB" >
   名字 : <input type="text" name="fname" class="input1">
</div>


<div class="LOGB">
   密码 : <input type="password" name="pws" class="input1">
</div>


<div class="LOGB">
   Email: <input type="text" name="email" class="input1">
</div>


<input type="submit" value="登录" class="LOGD">
</form>


<div class="LOGE" style="text-align: center">
<p>没有账号?<a href="注册.html">立即注册</a></p>
</div>
</div>

</body>
<script>
function validateForm() {
var x = document.forms["myForm"]["fname"].value;
if (x == null || x == "") {
alert("需要输入名字。");
return false;
}
var x = document.forms["myForm"]["pws"].value;
if (x == null || x == "") {
alert("密码必须填写。");
return false;
}
var x=document.forms["myForm"]["email"].value;
var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length){
alert("不是一个有效的 e-mail 地址");
return false;
}
}

</script>
</html>

相关文章

网友评论

      本文标题:2019-07-18

      本文链接:https://www.haomeiwen.com/subject/mptllctx.html