今天简单改了个二级连动。
<!--#include file="../../function/oaconn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<%dim count
        set rs=server.CreateObject("adodb.recordset")
        sql = "select * from oa_user where (bu_bumen like '%采购%科' or bu_bumen like '综合科') order by bu_id "
        rs.open sql,conn,1,1%>
<SCRIPT language = "JavaScript">
<!--//
    var onecount;
    onecount=0;
    subcat = new Array();
        <%count = 0
        do while not rs.eof %>
    subcat[<%=count%>] = new Array("<%= trim(rs("bu_name"))%>","<%=rs("bu_bumen")%>","<%=rs("bu_id")%>");<%count = count + 1
        rs.movenext
        loop
        rs.close
        %>
    onecount=<%=count%>;

function changelocation(locationid)
    {
    document.frm.bu_jbrid.length = 0;

    var locationid=locationid.split(",");
 var locationid=locationid[1];
    var i;
 document.frm.bu_jbrid.options[document.frm.bu_jbrid.length] = new Option('请选择','请选择');
    for (i=0;i < onecount; i++)
        {
            if (subcat[i][1] == locationid)
            {  
                document.frm.bu_jbrid.options[document.frm.bu_jbrid.length] = new Option(subcat[i][0], subcat[i][2]+'jb'+","+subcat[i][0]);
            }       
        }
       
    }

//--> 
    </SCRIPT>
</head>

<body>
<form name="frm" action="csxiala_deal.asp" method="post">
<table width="829" border="0" cellpadding="4" cellspacing="1" bgcolor="#ffffff">
<tr>
<td width="286">分配给科室&nbsp;
  <select size="1" name="bu_bmid" id="bu_bmid" onChange="changelocation(document.frm.bu_bmid.options[document.frm.bu_bmid.selectedIndex].value)">
<%
sql = "select * from oa_dw where (bu_name like '%采购%科' or bu_name like '综合科') order by bu_id"
set rs = conn.execute(sql)
do while not rs.eof
    
%>
<option value="<%=rs("bu_id")%>bm,<%=rs("bu_name")%>" style="color:#800000"><%=rs("bu_name")%></option>
<%
rs.movenext
loop
rs.close
set rs = nothing
%>
</select>
 经办人&nbsp;
 <select size="1" name="bu_jbrid" id="bu_jbrid">
 <%
sql = "select * from oa_user where (bu_name like '综合科') order by bu_id"
set rst = conn.execute(sql)
do while not rst.eof   
%> 
    <option value="请选择" style="color:#800000">请选择</option>
 <option value="<%=rst("bu_id")%>jb,<%=rst("bu_name")%>" style="color:#800000"><%=rst("bu_name")%></option>
 </select>
 <%
rst.movenext
loop
rst.close
set rst = nothing
%>
 </td></tr></table>
 <table width="100%">
 <tr><td><input name="submit" type="submit"  />&nbsp;&nbsp;<input name="" type="reset"  /></td></tr>
 </table></form>
</body>
</html>

posted on 2006-06-26 16:02  许维光  阅读(369)  评论(0)    收藏  举报