<style>
td {
border:1px solid #316ac5;
font-size:12px
}
body {
font-size:12px
}
</style>
<%
depart=Request.Form("depart").Item
submitname=String(Request.Form("submitname").Item)
if (submitname!="undefined"&&submitname!="")
{
Response.Write('<script language="javascript" >')
Response.Write('if (confirm("你确定你要查找的人是'+submitname+'吗?"))')
Response.Write('window.location.href="hrpersonal.asp?who='+submitname+'"')
Response.Write('</script>')
}
%>
<script language="javascript" defer>
obj=document.all.getname
function check() {
obj.submit()
}
function checklist() {
obj.submitname.value=obj.memberlist.options[obj.memberlist.selectedIndex].text
obj.submit()
}
function checkname(){
if (obj.nameid.value!="")
obj.submitname.value=obj.nameid.value
if (obj.nameuser.value!="")
obj.submitname.value=obj.nameuser.value
if (obj.nameaccount.value!="")
obj.submitname.value=obj.nameaccount.value
if (obj.nameid.value==""&&obj.nameuser.value==""&&obj.nameaccount.value=="")
alert("不能三个都是空")
else
obj.submit()
}
function checktable(a) {
obj.submitname.value=document.all("name"+a).innerText
obj.submit()
}
</script>
<html>
<head>
<title>人事管理系统</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<form name="getname" id="getname" method="post" action="hrchange.asp">
<fieldset>
<legend>你可以从列表中选取指定的某个职工</legend>
<select name="depart" id="depart" onchange="check();return false">
<option>-部门列表-</option>
<!--#include file="inc/conn.inc" -->
<%
var rs=conn.execute("select * from depart")
var departarr=new Array()
for (;!rs.EOF;rs.movenext())
departarr.push(String(rs.Fields("name")))
rs.close()
rs=null
for (departtemp in departarr)
{
if (departarr[departtemp]==depart)
Response.Write("<option value='"+depart+"' selected>"+depart+"</option>")
else
Response.Write("<option value='"+departarr[departtemp]+"'>"+departarr[departtemp]+"</option>")
}
//--------------------------------------------------end------------------------------------
%>
</select>
<select id="memberlist" name="memberlist">
<option value='职工列表' selected>-职工列表-</option>
<%
if ((depart!="-部门列表-")&&(depart!="undefined"))
{
var rs=conn.execute("select * from employee where departid='"+depart+"'")
var memberlistarr=new Array()
for (;!(rs.BOF||rs.EOF);rs.movenext())
memberlistarr.push(String(rs.Fields("name")))
rs.close()
rs=null
for (memberlisttemp in memberlistarr)
{
if (memberlisttemp==0)
Response.Write("<option value='"+memberlistarr[memberlisttemp]+"' selected>"+memberlistarr[memberlisttemp]+"</option>")
else
Response.Write("<option value='"+memberlistarr[memberlisttemp]+"'>"+memberlistarr[memberlisttemp]+"</option>")
}
}
%>
</select>
<button onclick="checklist()">决定选取</button>
</fieldset><br>
<fieldset>
<legend>可以直接从职工基本信息查询</legend>
请输入员工id: <input id="nameid" type="text" onfocus="document.all.getname.nameuser.value='';document.all.getname.nameaccount.value='';"><br>
或者姓名:<input id="nameuser" type="text" onfocus="document.all.getname.nameid.value='';document.all.getname.nameaccount.value='';"><br>
或者本系统帐号:<input id="nameaccount" type="text" onfocus="document.all.getname.nameuser.value='';document.all.getname.nameid.value='';"><br>来确定对那个员工操作,<font color=red>三者任选其一</font><br>
<button onclick="checkname()">确定</button>
</fieldset><br>
<fieldset>
<legend>你也可以直接对员工表选取员工</legend>
<%
var rs=Server.CreateObject("ADODB.Recordset")
var pagesize=2
//rs=conn.execute("select employeeID,name,sex,birth,married,strongskill,departid,type from employee")
rs.open("select id,name,sex,birth,married,strongskill,departid,type from employee",conn,1,3)
rs.PageSize=pagesize;
var pagenum=Number(rs.PageCount);
var fieldsnum=rs.Fields.count;
var curPage=new String(Request.QueryString("curPage").Item);
if (curPage=="undefined") //**判断有没有当前分页信息,如果没
{
curPage=1
rs.AbsolutePage=1 //**有,就把第一页设置为当前页
}
else
{
curPage=Number(curPage)
rs.AbsolutePage=curPage
} //**设置当前页
Response.Write("获得的当前页的值:"+curPage+" 当前页面总数:"+pagenum)
Response.Write("<table border=0 cellpadding=1 cellspacing=2><tr>")
for (i=0;i<fieldsnum;i++)
Response.Write("<td>"+rs.Fields(i).Name+"</td>")
Response.Write("<td>操作</td></tr>")
//----------输出表头
for (a=0;a<pagesize;a++)
{
if (!rs.EOF&&!rs.BOF)
{
Response.Write("<tr>")
for (i=0;i<rs.Fields.count;i++)
{
if (rs.Fields(i).Name=="name")
Response.Write("<td id='name"+a+"'>"+rs.Fields(i).Value+"</td>")
else if (rs.Fields(i).Name=="birth")
{
tempdate=new Date(String(rs.Fields(i).Value).toLocaleString())
Response.Write("<td>"+tempdate.getFullYear()+"年"+(tempdate.getMonth()+1)+"月"+tempdate.getDate()+"日"+"</td>")
}
else
Response.Write("<td>"+rs.Fields(i).Value+"</td>")
}
Response.Write("<td><button onclick='checktable("+a+")'>选取该职工</button></td></tr><br>")
rs.movenext()
}
else
break
}
Response.Write("</table>")
//输出表尾
function nextpage(a)
{
if (a<pagenum)
return ++a
else
return pagenum
}
function previewpage(a) {
if (a>1)
return --a
else
return 1
}
Response.Write("<table><tr><td><a href='hrchange.asp?curPage="+previewpage(curPage)+"'>上一页</a></td>")
Response.Write("<td><a href='hrchange.asp?curPage="+nextpage(curPage)+"'>下一页</a></td>")
Response.Write("<td>总共"+pagenum+"页 这是第"+curPage+"页</td></tr></table>")
%>
</fieldset>
<input name="submitname" id="submitname" type="hidden" value="">
</form>
</body>
</html>
那你看看我用js写的asp的一个oa系统
[此贴子已经被作者于2006-1-13 14:37:34编辑过]