服务端程序:
<%@Language=VBScript%>
<%RSDispatch %>//必需的
<!--@CopyWright&Edit by Wang xuejun April,2001--〉
<!--'please pay attention to the path of the folder _scriptlibrary,it should be included in. -->
<!--#INCLUDE FILE="../../_ScriptLibrary/RS.ASP"-->//同客户端
<SCRIPT RUNAT=SERVER LANGUAGE="JavaScript">
var public_description = new MyServerMethods();
function MyServerMethods()
{
this.add = Function( 'value','return add(value)' );//用java声明指向vbscript 函数
}
</SCRIPT>
<SCRIPT RUNAT=SERVER LANGUAGE="VBScript">
Function add(value)//value是传过来的父亲id
dim second,value1,value2
second=""
//下面是从表中根据得到的父类id 把子类找出来
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "cxxxx"
Set Rs= Server.CreateObject("ADODB.Recordset")
sqlText="select childid,description from table where fatherid="&value
Rs.open sqlText,conn,1
while not Rs.eof
second=second&Rs("childid")&"/"&Rs("description")&"/"
Rs.movenext
wend
rs.Close
conn.Close
set rs=nothing
set conn=nothing
add=second&"*"//用*表明数组完毕
End Function
</SCRIPT>
<%
gwid=request.querystring("id")
gwlc=request.querystring("lc")
'获取公文拟稿信息
sqlstr=swlist(gwid,"1","qy")
set rs=conn.execute(sqlstr)
djnr=rs("djnr")
errorInfo
%>
<script language=javascript>
function checkf()
{
if (document.form1.menu1.selectedIndex=="" || document.form1.menu2.selectedIndex==""|| document.form1.menu1.value=="请选择")
{alert ("false")};
else
{document.form1.cbr.value=group[document.form1.menu1.selectedIndex][document.form1.menu2.selectedIndex].text
alert(document.form1.cbr.value);
}
//document.form1.submit();
}
</script>
</head>
<body topmargin=20 leftmargin=20>
<form name="form1" method="post" action="gw_swdj_post.asp">
<%
sqlstr="select count(*) from xt_dept"
set rs_dept=conn.execute(sqlstr)
count=rs_dept(0)
response.write "<input type='hidden' name='dcount' value='"&count&"'>"
rs_dept.close
set rs_dept=nothing
%>
<input type="hidden" name="cbr">
<select name="menu1" size="1" onChange="redirect(this.options.selectedIndex)">
<option>请选择</option>
<script>
var groups=document.form1.dcount.value;
var group=new Array(groups+1);
for (i=0; i<groups; i++)
group[i+1]=new Array();
for (j=1;j<i+1;j++){
group[j][0]=j;
}
</script>
<%test%>
</select>
<select name="menu2" size="5" multiple>
<option>请选择</option>
</select>
<%
sub test()
str=" select deptid,bmmc from gs_user.xt_dept"
set Rs_dept=conn.execute(str)
if not Rs_dept.eof then
while not Rs_dept.eof
Response.Write "<option value="&Rs_dept("deptid")&">"&Rs_dept("bmmc")&"</option>"
Rs_dept.MoveNext
wend
Rs_dept.close
end if
set rs1=conn.execute(str)
if rs1.eof then
response.end
end if
i=1
response.write "<script>"
while not rs1.eof
bmmc=trim(rs1("bmmc"))
deptid=rs1("deptid")
response.write "group["&i&"][0]='"&bmmc&"';"
str2="SELECT username FROM xt_user WHERE deptid = '"&deptid&"'"
set rs2=conn.execute(str2)
j=1
while not rs2.eof
username=trim(rs2("username"))
response.write "group["&i&"]["&j&"]=new Option('"&username&"','');"
rs2.movenext
j=j+1
wend
rs1.movenext
i=i+1
wend
response.write "function redirect(x){"
response.write "for (m=document.form1.menu2.options.length-1;m>0;m--){"
response.write "document.form1.menu2.options[m]=null;}"
response.write "for (i=0;i<group[x].length;i++){"
response.write "if (x!=0)document.form1.menu2.options[i]=new Option(group[x][i].text,group[x][i].value)}"
response.write "}</script>"
rs1.close