我早上刚做了一个你试试,决对好用!!<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <SCRIPT language=JavaScript> var onecount; onecount=0; subcat = new Array(); <% i=0 set cn = Server.CreateObject("ADODB.Connection") cn.Open session("lr_ds"),session("lr_id"),session("lr_pw") sql="select * from fwlx" set rs=cn.execute(sql) if rs.eof and rs.bof then else do until rs.eof sql2="select * from fwwjt where fid='" & rs.fields("id") & "'" set rs2=cn.execute(sql2) if rs2.eof and rs2.bof then else do until rs2.eof %> subcat[<%=i%>] = new Array("<%=rs.fields("ftype")%>","<%=rs2.fields("title")%>"); <% rs2.movenext i=i+1 loop end if rs.movenext loop end if %> onecount=<%=i%>; function changelocation(locationid) { document.form1.filetitle.length = 0; var locationid=locationid; var i; var cfs; document.form1.filetitle.options[0] = new Option('=文件头=',''); cfs=''; cfz=''; if (locationid != cfs) document.form1.filetitle.options[0] = new Option('=文件头=',''); if (locationid != "=类型=") { for (i=0;i < onecount; i++) { if (subcat[i][0] == locationid) { if (cfz!=subcat[i][0]) document.form1.filetitle.options[document.form1.filetitle.length] = new Option(subcat[i][1], subcat[i][1]); } }
在下拉框中用onchange函数并自动刷新,另一个下拉框根据此来判断就可以了!
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT language=JavaScript>
var onecount;
onecount=0;
subcat = new Array();
<%
i=0 set cn = Server.CreateObject("ADODB.Connection")
cn.Open session("lr_ds"),session("lr_id"),session("lr_pw")
sql="select * from fwlx"
set rs=cn.execute(sql)
if rs.eof and rs.bof then
else
do until rs.eof
sql2="select * from fwwjt where fid='" & rs.fields("id") & "'"
set rs2=cn.execute(sql2)
if rs2.eof and rs2.bof then
else
do until rs2.eof
%>
subcat[<%=i%>] = new Array("<%=rs.fields("ftype")%>","<%=rs2.fields("title")%>");
<%
rs2.movenext
i=i+1
loop
end if
rs.movenext
loop
end if
%>
onecount=<%=i%>;
function changelocation(locationid)
{
document.form1.filetitle.length = 0; var locationid=locationid;
var i;
var cfs;
document.form1.filetitle.options[0] = new Option('=文件头=','');
cfs='';
cfz='';
if (locationid != cfs)
document.form1.filetitle.options[0] = new Option('=文件头=','');
if (locationid != "=类型=")
{
for (i=0;i < onecount; i++)
{
if (subcat[i][0] == locationid)
{
if (cfz!=subcat[i][0])
document.form1.filetitle.options[document.form1.filetitle.length] = new Option(subcat[i][1], subcat[i][1]);
}
}
}
}</SCRIPT>
</head><body>
<form name="form1" method="post" action="">
<%
set cn = Server.CreateObject("ADODB.Connection")
cn.Open session("lr_ds"),session("lr_id"),session("lr_pw")
sql="select * from fwlx"
set rs=cn.execute(sql)
%>
<select onChange=changelocation(document.form1.ftype.options[document.form1.ftype.selectedIndex].value)
name="ftype" size="1" id="ftype">
<option value="=类型=">=类型=</option>
<%do until rs.eof %>
<option value="<%=rs.fields("ftype")%>"><%=rs.fields("ftype")%></option>
<%
rs.movenext
loop
cn.close
%>
<option value="联合类型">联合类型</option> </select>
<select name="filetitle" size="1" id="filetitle">
<option value="=文件头=">=文件头=</option>
</select>
</form>
</body>
</html>
RemoteScripting比较难调试我现在都没调试成功 只有自己写Applet你可以察看相关文档