如果动态取的用ajax这样比较好
其实可以生成静态的javascript文件,然后用javascript写就可以了

解决方案 »

  1.   

    可否把二级新闻分类的数据库设计写上来呀?
    还有生成静态的JS我也没有做过,能一起发吗?
    发在这里也可以,用MSN 或QQ也行,谢谢了
    QQ:754903
    MSN:[email protected]
      

  2.   

    <%@ page contentType="text/html; charset=GB2312" %> 
    <?xml version="1.0" encoding="GB2312" standalone="yes"?> 
    <dummy> 
    <% 
    String id=request.getParameter("id"); 
    java.sql.ResultSet rs=null; 
    rs=dbConn.exceute("select codes,name from aa where id = " + id); 
    while(rs.next()){ 
    %> 
    <dummy2> 
    <codes> 
    <%=rs.getString(1)%> 
    </codes> 
    <name> 
    <%=rs.getString(2)%> 
    </name> 
    </dummy2> 
    <%}%> 
    </dummy> [/code:1:c51ef70a01] [code:1:c51ef70a01] 
    test.jsp <form name=test> 
    <select name=a onchange="change()"> 
    <option value=1>ONE</option> 
    <option value=2>TWO</option> 
    <option value=3>THREE</option> 
    <select> 
    <select name=b></select> 
    </form> 
    <XML id=xmldso></XML> 
    <script> 
    function change(){ 
    xmldso.async = false; 
    xmldso.load("data.jsp?id="+document.test.a.value); 
    with(document.test.b){ 
    xmldso.recordset.MoveFirst(); 
    for (var i=0;!xmldso.recordset.eof;i++){ 
    length=i+1; 
    options[i].value=xmldso.recordset.fields(0).value; 
    options[i].text=xmldso.recordset.fields(1).value; 
    xmldso.recordset.MoveNext(); 



    change(); 
    </script> [/code:1:c51ef70a01]