Skip to content

Commit

Permalink
hzuapps#7 hzuapps#152 提交实验代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaojudge committed Nov 14, 2016
1 parent 67354a6 commit 05cf899
Show file tree
Hide file tree
Showing 15 changed files with 11,019 additions and 550 deletions.
124 changes: 124 additions & 0 deletions labs/1414080902117/Register2.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>新用户注册界面</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap.min.css">

<!-- 可选的Bootstrap主题文件(一般不用引入) -->
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.0/css/bootstrap-theme.min.css">

<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="http://cdn.bootcss.com/jquery/1.11.1/jquery.min.js"></script>

<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery-1.11.3.js"></script>
<link rel="stylesheet" href="css/register2.css">

<script src="js/Register2.js"></script>
</head>

<body>
<form action="" method="post" id="form_rg">
<table align="center">
<tr>
<td colspan = "2" width="600">
<h2>新用户注册界面</h2>
<hr>
</td>
</tr>
<tr>
<td>
<div class="input-group">
<span class="input-group-addon">用户账号:</span>
<input type="text" class="form-control" placeholder="Username" id="account" onblur="f_acccheck()"/>
</div>
</td>
<td>
<div id="acc_rs"></div>
</td>
</tr>
<tr>
<td>
<br/>
</td>
</tr>
<tr>
<td>
<div class="input-group">
<span class="input-group-addon">用户密码:</span>
<input type="password" class="form-control" placeholder="Password" id="password" onblur="f_pwdcheck()"/>
</div>
</td>
<td>
<div id="pwd_rs"></div>
</td>
</tr>
<tr>
<td>
<br/>
</td>
</tr>
<tr>
<td>
<div class="input-group">
<span class="input-group-addon">密码确认:</span>
<input type="password" class="form-control" placeholder="Password" id="passwordr" onblur="f_pwdrcheck()"/>
</div>
</td>
<td>
<div id="pwd2_rs"></div>
</td>
</tr>
<tr>
<td>
<br/>
</td>
</tr>
<tr>
<td>
<div class="input-group">
<span class="input-group-addon">用户昵称:</span>
<input type="text" class="form-control" placeholder="Name" id="name" onblur="f_namecheck()"/>
</div>
</td>
<td>
<div id="name_rs"></div>
</td>
</tr>
<tr>
<td>
<br/>
</td>
</tr>
<tr>
<td colspan ="2" align="center">
<div class="list-group">
<a href="#" class="list-group-item active" id="register" onclick="f_register()">
注册
</a>
</td>
</tr>
</table>


</form>
</body>
</html>
Binary file removed labs/1414080902117/image/moto.png
Binary file not shown.
143 changes: 143 additions & 0 deletions labs/1414080902117/js/Register2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
function f_register()
{
var acc = document.getElementById("account").value;
var pwd = document.getElementById("password").value;
var name = document.getElementById("name").value;
var pwdr = document.getElementById("passwordr").value;
if(acc == "")
{
acc_rs.innerHTML = "<b style='color:#FF0000'>请输入账号</b>";
}
if(pwd == "")
{
pwd_rs.innerHTML = "<b style='color:#FF0000'>请输入密码</b>"
}
if(pwdr == "")
{
pwd2_rs.innerHTML = "<b style='color:#FF0000'>请再次输入密码</b>";
}
if(name == "")
{
name_rs.innerHTML = "<b style='color:#FF0000'>请输入用户昵称</b> ";
}
if(acc!=""&&pwd!=""&&pwdr!=""&&name!="" && acc_rs.innerHTML == "" && pwd_rs.innerHTML == "" &&pwd2_rs.innerHTML == ""&& name_rs.innerHTML == "")
{
$.ajax({
type: 'post',
url : '/ajax_two/servlet/servlet?account='+acc+'&password='+pwd+'&name='+name,
success:function(msg)
{
if('success' == msg)
{
location.replace("/ajax_two/servlet/servlet");
}
else
{

}
}

}).done(function(data)
{
console.log(data);
json = JSON.parse(data);

})
location.replace("success.jsp");
}

}

function f_pwdrcheck()
{
var pwd = document.getElementById("password").value;
var pwdr = document.getElementById("passwordr").value;
if(pwd == pwdr)
{
pwd2_rs.innerHTML ="";
}
else
{
pwd2_rs.innerHTML = "<b style='color:#FF0000'>两次输入密码不相同</b>";
}
}
function f_acccheck()
{
var acc = document.getElementById("account").value;
if(acc !="")
{
acc_rs.innerHTML ="";
$.ajax({
type: 'post',
url : '/ajax_two//servlet/check?account='+acc,
success:function(msg)
{
if('success' == msg)
{
location.replace("/ajax_two/servlet/check");
}
else
{

}
}

}).done(function(data)
{
console.log(data);
json = JSON.parse(data);
for(var i in json)
{
acc_rs.innerHTML = json["account"];
}
})
}
}

function f_pwdcheck()
{
var pwd = document.getElementById("password").value;
var pwdr = document.getElementById("passwordr").value;
if(pwd != "")
{
pwd_rs.innerHTML ="";
}
if(pwd == pwdr)
{
pwd2_rs.innerHTML ="";
}
else
{
pwd2_rs.innerHTML = "<b style='color:#FF0000'>两次输入密码不相同</b>";
}
}
function f_namecheck()
{
var name = document.getElementById("name").value;
if(name !="")
{
name_rs.innerHTML ="";
$.ajax({
type :'post',
url : '/ajax_two/servlet/check?name='+name,
success:function(msg)
{
if('success' == msg)
{
location.replace("/ajax_two/servlet/check");
}
else
{

}
}
}).done(function(data){
console.log(data);
json = JSON.parse(data);
for(var i in json)
{
name_rs.innerHTML = json["name"];
}
})
}
}
Loading

0 comments on commit 05cf899

Please sign in to comment.