1:我們先從html開始,注釋不多,希望諒解,下面是html頁面的代碼:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
<script type="text/javascript" src="jq/jquery-3.3.1.js"></script>
<link href="css/login.css" rel="stylesheet">
<script type="text/javascript" src="js/login.js"></script>
</head>
<body>
<div id="pop" style="display: none">
<div id="pop_ts">提示</div>
<div id="pop_tz">注冊成功!</div>
<div id="span" style="color: white" onclick="confirm()">確定</div>
</div>
<div id="header_top">
<div id="login">
<form id="form_1" class="box">
<span class="logo_logo"><a href="header.jsp" class="a_logo">LOGO</a></span>
<h1>登錄</h1>
<div id="login_ww" style="color: yellow"></div>
<input class="dc" id="username1" type="text" name="username" placeholder="用戶名">
<input class="dc" id="password1" type="password" name="password" placeholder="密碼">
<input type="submit" name="no" value="登錄" id="no">
<p class="meassage">還未注冊?<a id="onclick_1" onclick="fun('no')"> 注冊</a></p>
<div class="checkbox">
<label>
<input type="checkbox" name="yes" value="no" ><span class="checkboxmessage" style="font-size: 12px;">自動登錄</span>
</label>
</div>
</form>
</div>
<div id="register">
<form id="form" name="form" class="box">
<span class="logo_logo"><a href="header.jsp" class="a_logo">LOGO</a></span>
<h1>注冊頁面</h1>
<div id="errorMsg" style="color: yellow"></div>
<input class="a" id="username_1" type="text" name="username" placeholder="用戶名英文" >
<input class="a" id="password_1" type="password" name="password" placeholder="密碼:數(shù)字加英文">
<input class="a" id="phone_1" type="phone" name="phone" placeholder="中國移動電話號碼11位">
<input class="a" id="address_1" type="idcard" name="address" placeholder="地址如:四川省成都市武侯區(qū)">
<input class="a" id="rgdate_1" type="rgdate" name="rgdate" placeholder="時間" style="display: none">
<input type="submit" name="ok" id="ww" value="注冊">
<p class="meassage">已有賬號?<a id="onclick_2" onclick="fun('yes')">登錄</a></p>
</form>
</div>
</div>
</body>
</html>
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頁面.利用的是點擊事件;剩下的請看第二章哦!!!文章來源:http://www.zghlxwxcb.cn/news/detail-507856.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-507856.html
到了這里,關(guān)于登錄注冊頁面連接數(shù)據(jù)庫并完成注冊(一)的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!