日期:2014-05-17  浏览次数:21196 次

各位大哥,帮我看看这段代码错在哪里
当点击单选按钮一班时,下拉列表出现表class1班的全部name值,
当点击单选按钮二班时,下拉列表出现表class2班的全部name值。
<%@LANGUAGE= "VBSCRIPT "   CODEPAGE= "936 "%>
<!DOCTYPE   HTML   PUBLIC   "-//W3C//DTD   HTML   4.01   Transitional//EN "   "http://www.w3.org/TR/html4/loose.dtd ">
<html>
<head>
<meta   http-equiv= "Content-Type "   content= "text/html;   charset=gb2312 ">
<title> 无标题文档 </title>
</head>

<body>
<%   Set   conn=Server.CreateObject( "ADODB.Connection ")
conn.connectionString= "driver={SQL   Server};server=(local);UID=sa;PWD=sa;Database=haier "
conn.open
Set   rs=Server.CreateObject( "ADODB.Recordset ")
Set   rs.ActiveConnection=conn
rs.CursorType=3  
%>

<script   language=javascript>
var   arr   =   new   Array();
arr[0]   =   new   Array();
arr[1]   =   new   Array();  


<%
rs.open   "select   distinct   name   from   class1 "
Do   While   Not   rs.Eof
%>
addItem( <%=rs( "name ")%> ,   0);
<%           rs.MoveNext
Loop
rs.Close
rs.open   "select   distinct   name   from   class2 "
Do   While   Not   rs.Eof
%>
addItem( <%=rs( "name ")%> ,   1);
<%           rs.MoveNext
Loop
rs.Close

%>
function   addItem(s,   id)   {
        arr[id][arr[id].length]   =   s;

}
function   insertSLC(id)   {

        var   slc   =   document.form1.select1;
        slc.options.length=0;
        for   (var   i=0;   i <arr[id].length;   i++)
                slc.options[slc.options.length]   =   new   Option(arr[id][i],arr[id][i]);
}
document.form1.select2.onchange   =   function()   {
        if   (this.value   ==   2)
                this.form.n.disabled   =   true;
        else
                this.form.n.disabled   =   false;
}
</script>

<form   name= "form1 "   method= "post "   action= " ">
    <p>
        <label>
        <input   type= "radio "   name= "RadioGroup1 "   value= "单选 "   onclick= "insertSLC(0) ">
    一班 </label>
        <br/>
        <label>
        <input   type= "radio "   name= "RadioGroup1 "   value= "单选 "   onclick= "insertSLC(1) ">
    二班 </label>
    </p>
    <p> 下拉列表1 </p>
    <p>         <sel