我一直想做一个输入工号,就能自动跳出用户名,部门号.帮我看一下啊,谢谢!
<!-- #Include Virtual = "/Include/Conn.asp" -->
<!-- #Include Virtual = "/Include/Frequent.asp" -->
<html>
<head>
<title>test</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
var this.EngName.value = ""
var this.deptid.value = ""
function GetEmployeeInfomation(Badge)
{
var con = new server.createobject("adodb.connection");
var rs = new server.createobject("adodb.recordset");
var sql = "SELECT e.[EngName],e.[DeptId] from [Employee] e WHERE e.[Badge]='"+ [Badge] +"'";
con.Open(constr);
rs.Open(sql,con,1,1);
if(rs.RecordCount>0)
{
this.EngName.Value = rs.Fields("EngName").Value;
this.deptid.Value = rs.Fields("DeptId").Value;
}
else
{
alert("test!")
}
rs.Close();
con.Close();
}
}
</script>
</head>
<body bgcolor=silver text="#000000" >
<form name="form1" method="post" action="dealsurvey.asp">
<table border="0" cellspacing="10" cellpadding="0">
<tr>
<td height="22">Badge:<input type="text" name="Badge" value="" onChange='GetEmployeeInfomation(this.badge)' ></td>
<td>Name:<input type= "text" name = "EngName" value="" >
</td>
<td>Dept No:
<input type= "text" name = "deptid" value="" ></td>
</tr>
</table>
</form>
</body>
</html>