📄 emupdate.jsp~7~
字号:
<%@page contentType="text/html; charset=gb2312"%>
<%@page import="com.domain.EmployeeVO"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css/style.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
function CheckDate(INDate) //判断日期是否合法
{ if (INDate=="")
{return true;}
subYY=INDate.substr(0,4)
if(isNaN(subYY) || subYY<=0){
return true;
}
//转换月份
if(INDate.indexOf('-',0)!=-1){ separate="-"}
else{
if(INDate.indexOf('/',0)!=-1){separate="/"}
else {return true;}
}
area=INDate.indexOf(separate,0)
subMM=INDate.substr(area+1,INDate.indexOf(separate,area+1)-(area+1))
if(isNaN(subMM) || subMM<=0){
return true;
}
if(subMM.length<2){subMM="0"+subMM}
//转换日
area=INDate.lastIndexOf(separate)
subDD=INDate.substr(area+1,INDate.length-area-1)
if(isNaN(subDD) || subDD<=0){
return true;
}
if(eval(subDD)<10){subDD="0"+eval(subDD)}
NewDate=subYY+"-"+subMM+"-"+subDD
if(NewDate.length!=10){return true;}
if(NewDate.substr(4,1)!="-"){return true;}
if(NewDate.substr(7,1)!="-"){return true;}
var MM=NewDate.substr(5,2);
var DD=NewDate.substr(8,2);
if((subYY%4==0 && subYY%100!=0)||subYY%400==0){ //判断是否为闰年
if(parseInt(MM)==2){
if(DD>29){return true;}
}
}else{
if(parseInt(MM)==2){
if(DD>28){return true;}
}
}
var mm=new Array(1,3,5,7,8,10,12); //判断每月中的最大天数
for(i=0;i< mm.length;i++){
if (parseInt(MM) == mm[i]){
if(parseInt(DD)>31){return true;}
}else{
if(parseInt(DD)>30){return true;}
}
}
if(parseInt(MM)>12){return true;}
return false;
}
function checkrealname(realname){ //判断文本框中是否为汉字
var str=realname;
var Expression=/[^\u4E00-\u9FA5]/;
var objExp=new RegExp(Expression);
if(objExp.test(str)==true){
return true;
}else{
return false;
}
}
function updateTest(){
if(document.form.name.value==""){
window.alert("请填写姓名");
return false;
}
if(checkrealname(document.form.name.value)){
window.alert("您输入真实姓名不正确");
return false;
}
if(document.form.age.value==""){
window.alert("请填写年龄");
return false;
}
if(isNaN(document.form.age.value)){
window.alert("年龄只能为数字");
return false;
}
if(document.form.birthday.value==""){
window.alert("请填写出生日期");
return false;
}
if(CheckDate(document.form.birthday.value)){
alert("输入的日期不合法!(年-月-日)");
return false;
}
if(document.form.profession.value==""){
window.alert("请填写职务");
return false;
}
if(document.form.school.value==""){
window.alert("请填写毕业学校信息");
return false;
}
if(checkrealname(document.form.school.value)){
window.alert("您输入学校名称不正确");
return false;
}
return true;
}
</script>
<title>修改员工信息</title>
</head>
<body>
<table width="80%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#004C86" class="tableBorder_r">
<tr align="left" valign="top">
<td height="20%" colspan="3">
<jsp:include page="../top.jsp"/>
</td>
</tr>
<tr>
<td width="192" height="80%" background="picture/left.jpg" scope="row">
<jsp:include page="../ps.jsp"/> </td>
<td width="635" height="80%" scope="row">
<div align="center">
</div>
<%EmployeeVO vo=(EmployeeVO)request.getAttribute("employee");
%>
<form name="form" method="post" action="managerservlet?method=9&number=<%=session.getAttribute("number")%>" onSubmit="return updateTest()">
<table width="56%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#819BBC" bordercolorlight="#FFFFFF">
<tr align="center" bgcolor="#EFF6FE">
<td width="38%" height="28" colspan="2"> <strong>修改员工信息</strong> </td>
</tr>
<tr align="center">
<td width="38%" height="29" bgcolor="#EFF6FE">姓名:</td>
<td width="62%"><input type="text" name="name" value="<%=vo.getEm_name()%>"></td>
</tr>
<tr align="center">
<td height="29" bgcolor="#EFF6FE">性别:</td>
<td><input type="radio" name="sex" value="男" <%if(=vo.getEm_sex().equals("男")){out.println("checked");}%>>
男
<input type="radio" name="sex" value="女" <%if(=vo.getEm_sex().equals("女")){out.println("checked");}%>>
女</td>
</tr>
<tr align="center">
<td height="29" bgcolor="#EFF6FE">年龄:</td>
<td><input type="text" name="age" value="<%=vo.getEm_age()%>"></td>
</tr>
<tr align="center">
<td height="29" bgcolor="#EFF6FE">出生日期:</td>
<td><input type="text" name="birthday" value="<%=vo.getEm_birthday()%>"></td>
</tr>
<tr align="center">
<td height="29" bgcolor="#EFF6FE">毕业学校:</td>
<td><input type="text" name="school" value="<%=vo.getEm_school()%>"></td>
</tr>
</table>
<p align="center">
<input type="submit" name="Submit" value="提交">
<input type="reset" name="Submit3" value="重置">
<input type="button" name="Submit3" value="返回" onclick="javascript:history.back();">
</form>
</p>
<p> </p> <p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p></td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -