尝试了几个小时未果的问题,javascript 能实现吗?
yd 2003-04-11 09:27:10
一个注册信息的asp
本问题涉及了两个表,部门表和员工表
部门表里有两个字段,自动编号 和 部门名称
员工表有三个字段,自动编号、姓名和所在部门
在fillinfo.asp里有两个下拉选择框,部门,员工
默认状态下,部门为无,员工为公司所有员工
能否出现下面的结果:
在选择了具体部门后,员工的下拉选择框里则变为该部门的员工,而不是公司所有员工
我尝试了下面的方法,但是失败了
sub myListSel1(tablename,name)
strSQL = request("sql");
strSQL = "select * from " & tablename
set rst = Conn.Execute(strSQL)
do while not rst.eof
Response.Write("<option value='" & rst(name) & "'")
response.write ">"
response.write (rst(name) & "</option>")
rst.MoveNext
loop
rst.Close
set rst = nothing
end sub
sub myListSel2(name)
strSQL = request("sql")
if strSQL = "" then strSQL = "select * from 员工"
set rst = Conn.Execute(strSQL)
do while not rst.eof
Response.Write("<option value='" & rst(name) & "'")
response.write ">"
response.write (rst(name) & "</option>")
rst.MoveNext
loop
rst.Close
set rst = nothing
end sub
<script>
function checkfind(f)
{
s = "select * from 使用人 ";
if (f.equsybm.value != "none")
s = s + " where 使用人.部门='" + f.equsybm.value+ "'";
f.sql.value = s;
return true;
window.location.reload();
}
</script>
<td>部门:</td>
<td align=left>
<input type=hidden name="sql">
<select name=equsybm class=recordinput onchange="return checkfind(document.ff);">
<%myListSel1 "部门","部门"%>
</select>
</td>
<td>员工:</td>
<td align=left>
<select name=equsyr class=recordinput>
<%myListSel2 "员工"%>
</select>
</td>
</tr>
怎么也不行,是不是本来这种思路都不对呢?