document.form1.select_bmid.length = 0;

解决方案 »

  1.   

    document.form1.select_bmid.innerHTML = "";
      

  2.   

    请查检你其它javascript语句是否准确。
      

  3.   

    最好在Netscape里调试,Netscape里有:tool-web development-javascript console
    可以很方便地查看错误。
      

  4.   

    我打源代码完整的贴出来了,大家看看,我这里运行还是有问题的。
    <html>
    <head>
    <title></title>
    <meta content="text/html; charset=gb2312" http-equiv="Content-Type">
    <link rel="stylesheet" href="../template/style.css" type="text/css">
    <style type="text/css">
    <!--
    .STYLE3 {font-size: 9px}
    -->
    </style>
    </head>
    <script language="JavaScript">
    <!--
    var subval = new Array();
    subval[0] = new Array('15','0','1-a')
    subval[1] = new Array('15','1','2-a')
    subval[2] = new Array('15','2','3-a')
    subval[3] = new Array('15','3','4-a')
    subval[4] = new Array('15','4','5-a')
    subval[5] = new Array('15','5','6-a')
    subval[6] = new Array('15','6','7-a')
    subval[7] = new Array('15','7','8-a')
    subval[8] = new Array('15','8','9-a')
    subval[9] = new Array('15','9','10-a')
    subval[10] = new Array('28','10','11-a')
    subval[11] = new Array('28','11','12-a')
    subval[12] = new Array('28','12','13-a')
    subval[13] = new Array('28','13','14-a')
    function changeselect1(locationid)
    {
    var bmtext;
    var bmid;
    // document.form1.select_bmid.options.length = 0;//按理来说这句应该是对的,可就是运行有问题
            document.form1.select_bmid.innerHTML = "";//FF注意游览器提示这句有问题
    for(i=0;i<subval.length;i++){
    bmtext=subval[i][2];
    bmid=subval[i][1];
    var oOption = document.createElement('OPTION');
    oOption.text = bmtext;
    oOption.value = bmid;
    if (subval[i][0] == locationid){
    document.form1.select_bmid.options.add(oOption);
    }
    }
    }//-->
    </script>
    <body leftmargin="20" topmargin="20" marginwidth="20" marginheight="20"  style="table-layout:fixed; word-break:break-all"><form action=""  method="post" name="input" id="form1" >
    <select name="select_lmid" id="select_lmid" onChange="changeselect1(this.value)">
    <option value="" ></option>
    <option value="15" >TEST</option>
    <option value="28" >TEST2</option></select>
    <select name="select_bmid" id="select_bmid"></select></form></body>
    </html>
      

  5.   

    谢谢大家的参于,这个问题我自己解决了,按标准的写法是:
    document.getElementById('form1').select_bmid.options.length = 0;
    按wasuka(曲奇的吹火棍) 的方法也可以,不过也不完全正确,正确的写法应该是
    document.getElementById('form1').select_bmid.innerHTML = "";