input.jsp(01)

<%@ page language="java" contentType="text/html; charset=GB18030"
    pageEncoding="GB18030"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>添加用户</title>
<link rel="stylesheet" href="../style/drp.css">
<script src="../script/client_validate.js"></script>
<script type="text/javascript">

function addUser() {
if (document.getElementById("userId").value.length <4) {
alert("用户代码不能小于4个字符!");
document.getElementById("userId").focus();
return;
}
var firstChar = document.getElementById("userId").value.charAt(0);

if (!(firstChar >= 'a' && firstChar <='z')) {
alert("用户代码首字符必须为字母");
document.getElementById("userId").focus();
return;
}
if(document.getElementById("userName").value == "") {
alert("用户名称不能为空!");
document.getElementById("userName").focus();
return;
}
if (document.getElementById("password").value.length <6) {
alert("输入的密码不能小于6位字符");
document.getElementById("password").focus();
return;
}
with (document.getElementById("userForm")) {
method = "post";
action = "add.do";
submit();
}
}

function goBack() {
window.self.location ="list.do"
}

function init() {
document.userForm.userId.focus();
}
</script>
</head>

<body class="body1">
<form name="userForm" target="_self" id="userForm">
<div align="center">
<table width="95%" border="0" cellspacing="2" cellpadding="2">
<tr>
<td>
&nbsp;
</td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0"
height="25">
<tr>
<td width="522" class="p1" height="25" nowrap>
<img src="../images/mark_arrow_03.gif" width="14" height="14">
&nbsp;
<b>系统管理&gt;&gt;用户维护&gt;&gt;添加</b>
</td>
</tr>
</table>
<hr width="97%" align="center" size=0>
<table width="95%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="22%" height="29">
<div align="right">
<font color="#FF0000">*</font>用户代码:&nbsp;
</div>
</td>
<td width="78%">
<input name="userId" type="text" class="text1" id="userId"
size="10" maxlength="10">
</td>
</tr>
<tr>
<td height="26">
<div align="right">
<font color="#FF0000">*</font>用户名称:&nbsp;
</div>
</td>
<td>
<input name="userName" type="text" class="text1" id="userName"
size="20" maxlength="20">
</td>
</tr>
<tr>
<td height="26">
<div align="right">
<font color="#FF0000">*</font>密码:&nbsp;
</div>
</td>
<td>
<label>
<input name="password" type="password" class="text1"
id="password" size="20" maxlength="20">
</label>
</td>
</tr>
<tr>
<td height="26">
<div align="right">
联系电话:&nbsp;
</div>
</td>
<td>
<input name="contactTel" type="text" class="text1"
id="contactTel" size="20" maxlength="20">
</td>
</tr>
<tr>
<td height="26">
<div align="right">
email:&nbsp;
</div>
</td>
<td>
<input name="email" type="text" class="text1" id="email"
size="20" maxlength="20">
</td>
</tr>
</table>
<hr width="97%" align="center" size=0>
<div align="center">
<input name="btnAdd" class="button1" type="button" id="btnAdd"
value="添加" onClick="addUser()">
&nbsp;&nbsp;&nbsp;&nbsp;
<input name="btnBack" class="button1" type="button" id="btnBack"
value="返回" onclick="goBack()" />
</div>
</div>
</form>
</body>
</html>

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