<select name=a onChange="changeform(this.options[selectedIndex].value)" >在js里面
function changeform(str){
document.forms[0].b.value=str;}
b为第2个下拉列表。

解决方案 »

  1.   

    <script>
    function changeS1()
    {
        s2.options[0] = new Option("111111")
        s2.options[1] = new Option("222222")
        s2.options[2] = new Option("333333")
        s2.options[3] = new Option("444444")
    }</script>=========================================================如果我要把function里面的s2.options的内容,显示为用php读取的记录,应该怎样写?我试过在script里面写上<? echo "xxxxx" ?>,好象不行的,如何写才正确呢?
      

  2.   

    <form name=form1 >
    <select name=s1 onChange=mm()>
    <option value="1">CPU
    <option value="2">主板
    <option value="3">硬盘
    </select>
    <select name=s2>
    <option>intel
    <option>AMD
    <option>狗剩
    </select>
    </form>
    <script>
    function mm(){
        document.form1.s2.options.length=null    if(document.form1.s1.options[document.form1.s1.selectedIndex].value=="2")
        {
            document.form1.s2.options[0]=new Option("微星","1")
            document.form1.s2.options[1]=new Option("技加","2")
            document.form1.s2.options[2]=new Option("华硕","3")
        }
        if(document.form1.s1.options[document.form1.s1.selectedIndex].value=="3"){
            document.form1.s2.options[0]=new Option("希捷","1")
            document.form1.s2.options[1]=new Option("西数","2")
            document.form1.s2.options[2]=new Option("破IBM","3")
        }
    }
    </script>
      

  3.   

    啊?
    还有啊,PHP我不会,只会一点ASP