响应该onchange事件,在对应的方法中做需要的修改

解决方案 »

  1.   

    <SCRIPT LANGUAGE=javascript>
    skind_1='0';
    sskind_1='0';
    prvarr= new Array(170);
    ctylst= new Array(1000);
    <%
    dim i,j
    i=1
    j=1
    set rsk=server.CreateObject("adodb.recordset")
    rsk.open "select distinct type from 库存表",conn,1if not rsk.eof then

    response.Write("prvcnt=")%>

    <%=rsk.recordcount+1%>

    <% response.Write(";"+chr(13)+chr(10))
    else
    response.Write("prvcnt=0;"+chr(13)+chr(10))
    end ifresponse.Write("prvarr["+cstr(i)+"]=new prv('0','0','请选择类型');"+chr(13)+chr(10))
    response.Write("ctylst["+cstr(j)+"]=new prvcty('0','0','请选择名称','0');"+chr(13)+chr(10))
    set rskk=server.CreateObject("adodb.recordset")
    i=i+1
    j=j+1while not rsk.eof
    rskk.open "select name from 库存表 where type='"+rsk.fields("type")+"'",conn
    response.Write("prvarr["+cstr(i)+"]=new prv("+cstr(i-1)+",'"+rsk.fields("type")+"','"+rsk.fields("type")+"');"+chr(13)+chr(10))

    response.Write("ctylst["+cstr(j)+"]=new prvcty("+cstr(i-1)+",'0','请选择名称','0');"+chr(13)+chr(10))
    j=j+1
    while not rskk.eof 
    response.Write("ctylst["+cstr(j)+"]=new prvcty("+cstr(i-1)+",'"+rskk.fields("name")+"','"+rskk.fields("name")+"','"+rsk.fields("type")+"');"+chr(13)+chr(10))
    j=j+1
    rskk.movenext
    wend

    rskk.close
    rsk.movenext
    i=i+1
    wend
    response.Write("ctycnt="+cstr(j-1)+";")
    rsk.close
    set rsk=nothing
    set rskk=nothing
    %>function prvcty(pid,cid,name,sid) {this.pid=pid;this.cid=cid;this.name=name;this.sid=sid;} function prv(id,kid,name) {this.id=id;this.kid=kid;this.name=name;} function ctychg(n,k)
    {
            
    lth=document.form.t97.length
    for (i=0;i<=lth;i++)
    {
    document.form.t97.remove(0);
    }

    for (j=1;j<=ctycnt;j++)
    {
    if (ctylst[j].sid==n )
    {
    var oOption = document.createElement("OPTION"); oOption.text=ctylst[j].name;
    oOption.value=ctylst[j].cid;
    document.form.t97.add(oOption); if (ctylst[j].cid==k)
    {
    oOption.selected=1;
    cityname = ctylst[j].name;
                                   
    }
    oOption.empty;
    }
    }
    }
    </SCRIPT>
    <html><body>
    <select  name='t96' onChange="ctychg(document.form.t96.value,'')">
              <script language=javascript>
    for(i=1;i<=prvcnt;i++)
    {
    document.write ('<option value=');
    document.write (prvarr[i].kid);
    //if (prvarr[i].name=='' )
    //document.write (' selected');
    document.write ('>');
    document.write (prvarr[i].name);
    document.write ('</option>');
    }
    </script>
            </select><select   name='t97'>
                <script language=javascript>
    {
    ctychg(document.form.t96.value,'');
    }
              </script>
              </select>
    </body>
    </html>
      

  2.   

    以上代码需要一个库(ACCESS就可以),一个表(名叫:库存表),两个字段(name,type)type为类型,name为名称,选类型就可以实现名称列表的变化。
      

  3.   

    这个需要看你右边的那些内容是一次性下载到客户段还是动态的从服务器端读取。如果是一次性下载下来,那就用js来更换就可以。如果是动态地从服务器端获取内容,那就需要使用ajax。
      

  4.   

    那你就给下拉列表加一个onchange事件,但选项变更之后,取得选项中的内容,然后在相应的变更内容不就行了吗