select 控件ID=ListBox1btn按钮为:
<input name="" type="button" onclick="javascript:document.getElementById('ListBox1').objSelect.options.length = 0" value="删除全部" class="btn"/>请问正确写法是是么???

解决方案 »

  1.   

    <input name="" type="button" onclick="javascript:document.getElementById('ListBox1').length = 0" value="删除全部" class="btn"/>同时提醒下
    我严重怀疑你的listbox1是服务器端控件。如果是这样的话,到前台的话可能ID不叫listbox1了
      

  2.   

    这个比较麻烦。
    onclick="removeSelect()"function removeSelect() {
        var selects = document.getElementsByTagName("select");
        for(var i in selects) {
           if(selects[i].id.indexOf("ListBox1")>=0) {
                selects[i].length = 0;
           }
        }
    }