⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 add.asp

📁 办公系统
💻 ASP
字号:
<!--#include file="../includes/db.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>办公自动化系统</title>
<script language="javaScript">
function validate(){ 
   var Pername = document.FormAdd.Per_name.value;
   var Dept_id = document.FormAdd.Dept_id.value;
   var Position_id = document.FormAdd.Position_id.value;
   if (Pername==""){
      alert("姓名不能为空");
      return false;
   }
   if (Dept_id==""){
      alert("请选择部门");
      return false;
   }
   if (Position_id==""){
      alert("请选择职位");
      return false;
   }
}
</script>

<style type="text/css">
<!--
.style1 {
	color: #000000;
	font-weight: bold;
}
-->
</style>
<link href="../Includes/Style.css" rel="stylesheet" type="text/css">
</head>

<body>
<%
call insureID()
%>
<table border="0" width="100%" cellspacing="0" cellpadding="0" height="40">
 <tr>
  <td width="100%"></td>
 </tr>
</table>
<center>
<form name="FormAdd" method="POST" action="save.asp?Action=Add" onSubmit="return validate()">
<table width="75%" border="0" cellpadding="0" cellspacing="1" bgcolor="#5A8BCE">
 <tr>
  <td height="35" align=left bgcolor="#E6F7FF">
    <div align="center" class="style1"><%=session("Dept_name")%>部门职员添加</div></td>
  </tr>
</table>
<table width="75%" border="0" cellpadding="4" cellspacing="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" bgcolor="#5A8BCE">
  <tr>
   <td width="20%" bgcolor="#FCFCFC" height="19">姓名</td>
   <td width="55%" bgcolor="#FCFCFC" height="19"><input name="Per_name" type="text"  size="20"></td>
  </tr>
  <tr>
   <td width="20%" bgcolor="#FCFCFC" height="19">性别&nbsp;</td>
   <td width="55%" bgcolor="#FCFCFC" height="19">
   <select size="1" name="Sex">
   <option value="" selected>--请选择--</option>
   <option value="男">男</option>
   <option value="女">女</option>
   </select>
   </td>
  </tr>
  <tr>
   <td width="20%" bgcolor="#FCFCFC" height="19">部门</td>
   <td width="55%" bgcolor="#FCFCFC" height="19">
	<%
	if session("Position_id")=4 then
		response.write"<input type=""hidden"" value="""&session("Dept_id")&""" name=""Dept_id"">"
		response.write session("Dept_name")
	elseif session("Position_id")=1 then
		response.write "<select size=""1"" name=""Dept_id"">"
		response.write "<option value="""" selected>--请选择--</option>"
		set rs=Server.CreateObject("Adodb.Recordset")
		sql="SELECT * FROM Dept"
		call openDB()
		rs.open sql,conn,1,1
		while not rs.eof
			response.write "<option value="""&rs("Dept_id") _
			&""">"&rs("Dept_name")&"</option>"
			rs.MoveNext
		wend
		response.write "</select>"
		set rs=nothing
	end if
	%>
   </td>
  </tr>
  <tr>
   <td width="20%" bgcolor="#FCFCFC" height="17">职位</td>
   <td width="55%" bgcolor="#FCFCFC" height="17"><select size="1" name="POSITION_ID">
   <option value=""  selected>--请选择--</option>
   <%
   set rs=Server.CreateObject("Adodb.Recordset")
   sql="SELECT * FROM Position ORDER BY Position_id DESC"
	rs.open sql,conn,1,1
	while not rs.eof
		if session("Position_id")=4 then
			if rs("Position_id")<=session("Position_id") then
				rs.MoveNext
			else
				response.write"<option value="""&rs("Position_id")&""">"&rs("Position_name")&"</option>"
				rs.MoveNext
			end if
		elseif session("Position_id")=1 then
			if rs("Position_id")=1 or rs("Position_id")>4 then
				rs.MoveNext
			else
				response.write"<option value="""&rs("Position_id")&""">"&rs("Position_name")&"</option>"
				rs.MoveNext
			end if
		else
			response.redirect "../Default.htm"
		end if
	wend
	call closeDB()
   %>
    </select></td>   
  </tr>
  <tr>
   <td width="75%" height="50" colspan="2" bgcolor="#EFEFEF"align=center>
    <input name="submit" type="submit" class="buttonface" value="提交"></td>
  </tr>
 </table>
</form>
</center>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -