标签:账号 meta pass org top 接受 res rman auto
StudentOperate.java
<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>注册</title>
<style>
.demo {
width: 150px;
height: 20px;
float: left;
}
.tian {
color: red;
float: left;
}
#end {
position: absolute;
top: 0px;
right: 0px;
}
</style>
</head>
<body background="2.jpg"
style="background-repeat: no-repeat; background-size: 100%;">
<h4 align="left">当前位置:添加学生信息</h4>
<form method="post" action="operate?method=register"
onSubmit="return check();">
<div>
<table style="margin-left: 20%;" border="0" width=‘60%‘>
<tr>
<th>登录账号:</th>
<td style="width: 80%;"><input type="text" id="account"
name="account" class="demo" onchange="checkaccount()"> <span
id="div1" class="tian"></span></td>
</tr>
<tr>
<th>登录密码:</th>
<td><input type="password" id="code" name="code" class="demo"
onchange="checkcode()"> <span id="div2" class="tian"></span></td>
</tr>
<tr>
<th>性别:</th>
<td><select name="sex">
<option value="男">男</option>
<option value="女">女</option>
</select></td>
</tr>
<tr>
<th>姓名:</th>
<td><input type="text" id="name" name="name" class="demo" onchange="checkname()">
<span id="div3" class="tian"></span></td>
</tr>
<tr>
<th>学号:</th>
<td><input type="text" id="num" name="num" class="demo"
onchange="checknum()"> <span id="div4" class="tian"></span></td>
</tr>
<tr>
<th>电子邮件:</th>
<td><input type="text" id="email" name="email" class="demo"
onchange="checkemail()"> <span id="div5" class="tian"></span></td>
</tr>
<tr>
<th>所在学院:</th>
<td><input type="text" id="college" name="college"
class="demo" onblur="checkcollege()"> <span id="div6"
class="tian"></span></td>
</tr>
<tr>
<th>所在系:</th>
<td><input type="text" id="major" name="major" class="demo"
onblur="checkmajor()"> <span id="div7" class="tian"></span></td>
</tr>
<tr>
<th>所在班级:</th>
<td><input type="text" id="class" name="class" class="demo"
onblur="checkclass()"> <span id="div8" class="tian"></span></td>
</tr>
<tr>
<th>入学年份(界):</th>
<td><select name="year">
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
</select>届<span id="div9" class="tian"></span></td>
</tr>
<tr>
<th>生源地:</th>
<td><input type="text" id="home" name="home" class="demo"
onchange="checkphone()"> <span id="div10" class="tian"></span></td>
</tr>
<tr>
<th>备注:</th>
<td><textarea rows="8" cols="40" id="other" name="other"
onchange="checkother()"> </textarea><span id="div11" class="tian"></span></td>
</tr>
</table>
<input style="margin-left: 42.5%" type="submit" value="添加">
</div>
</form>
<script type="text/javascript">
function checkaccount() {
var div = document.getElementById("div1");
div.innerHTML = "";
var account = document.getElementById("account");
if (account.value == " ") {
div.innerHTML = "用户名不能为空!";
account.focus();
return false;
}
var characcount1 = account.value.toLowerCase();
for (var i = 0; i < account.value.length; i++) {
var characcount = characcount1.charAt(i);
if (!(characcount >= 0 && characcount <= 9)
&& (!(characcount >= ‘a‘ && characcount <= ‘z‘))
&& (characcount != ‘_‘)) {
div.innerHTML = "用户名包含非法字符!";
account.focus();
return false;
}
}
if (account.value.length<6||account.value.length>12) {
div.innerHTML = "长度6-12个字符!";
account.focus();
return false;
}
return true;
}
function checkcode() {
var div = document.getElementById("div2");
div.innerHTML = "";
var code = document.getElementById("code");
if (code.value == " ") {
div.innerHTML = "密码不能为空!";
code.focus();
return false;
}
if (code.value.length<8||code.value.length>16) {
div.innerHTML = "密码长度8-16位!";
code.focus();
return false;
}
return true;
}
function checkname() {
var div = document.getElementById("div3");
div.innerHTML = "";
var name = document.getElementById("name");
if (name.value =="") {
div.innerHTML = "姓名不能为空!";
name.select();
return false;
}
return true;
}
function checknum() {
var div = document.getElementById("div4");
div.innerHTML = "";
var reg = /^2018(\d{4})$/;
var num = document.getElementById("num");
if (num.value == "") {
div.innerHTML = "学号不能为空!";
num.select();
return false;
}
div.innerHTML = "";
if (!reg.test(num.value)) {
div.innerHTML = "学号格式错误!学号以2018开头!";
num.select();
return false;
}
return true;
}
function checkemail() {
var div = document.getElementById("div5");
div.innerHTML = "";
var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
var email = document.getElementById("email");
if (!reg.test(email.value)) {
div.innerHTML = "大哥邮箱格式错误!";
email.select();
return false;
}
if (email.value == " ") {
div.innerHTML = "大哥你还没输入自己的邮箱!";
email.select();
return false;
}
return true;
}
function check() {
if (checkaccount() && checkcode() && checkname() && checknum() && checkemail())
{
confirm("恭喜您成功入坑石家庄铁道大学!");
return true;
}
confirm("格式错误!笨蛋!");
return false;
}
</script>
</body>
</html>
标签:账号 meta pass org top 接受 res rman auto
原文地址:https://www.cnblogs.com/zl00/p/11717305.html