我想用一个下拉列表来控制下面的下拉列表的出现与不显示
比如
<html:select property="courseType" onclick="" >
<html:option value="0">请选择</html:option>
<html:option value="1">专业课</html:option>
<html:option value="2">公共课</html:option>
</html:select>我想点击专业课的时候  底下会出现两个另外的下拉列表再次选择
而点击公共课的时候  底下的两个另外的下拉列表消失我对javascript不了解   希望能回复清楚一点 谢谢了   最好有实列让我学习一下

解决方案 »

  1.   

    dtree
    xtree
    百度找就行了。
      

  2.   

    用div的显示和隐藏也可以的嘛!不过最好不要用onclick事件用onchange事件最好
      

  3.   

    楼主我写了一个不知道是不是你想要的效果你可以去试下。(IE不支持)<body id="b">
    <select id="sel" onchange="show()">
    <option value="0">请选择</option>
    <option value="1">专业课</option>
    <option value="2">公共课</option>
    </select>
    </body><script type="text/javascript">
    var sel=null;
    function show(){
    if(document.getElementById("sel").value==1){
    sel=document.createElement("select");
    var op1=document.createElement("option");
    op1.innerHTML="java";
    var op2=document.createElement("option");
    op2.innerHTML=".net";
    var op3=document.createElement("option");
    op3.innerHTML="oracle";
    sel.options.add(op1);
    sel.options.add(op2);
    sel.options.add(op3);
    document.getElementById("b").appendChild(sel);
    }else if(document.getElementById("sel").value==2){
    if(sel!=null){
    sel.parentNode.removeChild(sel);
    }
    }
    }
    </script>
      

  4.   

    自我修改一下
    把op.innerHTML改成op.text在ie和火狐中都无bug了op1.text="java";
    op2.text=".net";
    op3.text="oracle";