登录注册页面连接数据库并完成注册(一)

1:我们先从html开始,注释不多,希望谅解,下面是html页面的代码:

<%@ page contentType="text/html;charset=UTF-8" language="java" %>


    Title
    
    
    


    
    

登录

还未注册? 注册

注册页面

已有账号?登录

2:下面是一个css代码,可能比较乱:

body{
    margin: 0;
    padding: 0;
    font-family: sans-serif;
    background-image: url("../images/bg_01.png");
    background-size: cover;
}
a{
    cursor: pointer;
}
.box{
    width: 300px;
    padding: 40px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    background: #191919;
    opacity: 0.5;
    text-align: center;
}
.box h1{
    color: white;
    text-transform: uppercase;
    font-weight: 500;
}
.box input[type = "text"],.box input[type = "password"]{
    border:0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 2px solid #3498db;
    padding: 14px 10px;
    width: 200px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25s;
}
.box input[type = "text"]:focus,.box input[type = "password"]:focus{
    width: 280px;
    border-color: #2ecc71;
}
.box input[type = "text"],.box input[type = "rgdate"]{
    border:0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 2px solid #3498db;
    padding: 14px 10px;
    width: 200px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25s;
}
.box input[type = "text"]:focus,.box input[type = "rgdate"]:focus{
    width: 280px;
    border-color: #2ecc71;
}
.box input[type = "submit"]{
    border:0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 2px solid #2ecc71;
    padding: 14px 40px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25s;
    cursor: pointer;
}
.box input[type = "submit"]:hover{
    background: #2ecc71;
}
.box .meassage{
    text-transform: uppercase;
    color:white;
}
.box .meassage a{
    color: aqua;
    text-decoration: none;
}
.checkboxmessage{
    color:white;
    font-size:18px;
}
.box input[type = "text"]:focus,.box input[type = "idcard"]:focus{
    width: 280px;
    border-color: #2ecc71;
}
.box input[type = "text"],.box input[type = "idcard"]{
    border:0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 2px solid #3498db;
    padding: 14px 10px;
    width: 200px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25s;
}.box input[type = "text"]:focus,.box input[type = "phone"]:focus{
     width: 280px;
     border-color: #2ecc71;
 }
.box input[type = "text"],.box input[type = "phone"]{
    border:0;
    background: none;
    display: block;
    margin: 20px auto;
    text-align: center;
    border: 2px solid #3498db;
    padding: 14px 10px;
    width: 200px;
    outline: none;
    color: white;
    border-radius: 24px;
    transition: 0.25s;
}
.a_logo{
    cursor: pointer;
    color: rgb(189, 159, 170) ;
}
#register{
    display: none;
}
.logo_logo {
    width: 70px;
    height: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    float: left;
    text-align: center;
    display: inline;
    font-size: 20px;
    color: rgb(189, 159, 170) ;
    font-family: "Lucida Calligraphy";
}
#pop {
    width: 400px;
    height: 250px;
    top: 20%;
    left: 37%;
    position: absolute;
    background-color: white;
    z-index: 10;
}
#pop_ts{
    width: 400px;
    height: 100px;
    background-color: #191919;
    color: white;
    font-size: 35px;
    text-align: center;
    line-height: 100px;
}
#pop_tz{
    width: 400px;
    height: 50px;
    text-align: center;
    line-height: 50px;
    margin-top: 40px;
}
#span {
    width: 100px;
    height: 40px;
    background-color: #3498db;
    text-align: center;
    line-height: 40px;
    margin: 20px auto;
    cursor: pointer;
}

3:然后我们看看样式是什么样子吧:

 4:因为登录注册是在一个页面上面显示的,点击登录会把登录这个div页面隐藏,然后显示注册的div页面.利用的是点击事件;剩下的请看第二章哦!!!

 登录注册页面连接数据库并完成注册(一)_第1张图片

你可能感兴趣的:(servlet,java,html)