好像没有removeall,用for循环一个一个remove吧

解决方案 »

  1.   

    <select name=select1>
      <option value=1>1
      <option value=2>2
    </selct>
    <input type=button onclick="hoho()" value=吼吼>
    <script>
    function hoho(){
    document.all.select1.options[document.all.select1.selectedIndex]=null;
    }
    </script>
      

  2.   

    for (i=select.options.length-1;i>=0;i--)
    {
      select.options.remove(i);
    }
      

  3.   

    document.all.sel.options.length = 0; //sel为select的name
      

  4.   

    <form name="form1">
    <select size="8" name="selUser"  style="width:250" multiple>
    <option name="1" value="1">1</option>
    <option name="5" value="5">5</option>
    </select>
    <input type="button" name="del" value="delme" onclick="delall()">
    </form><script language="Javascript">
    function delall(){
      var ln = form1.selUser.options.length;
      alert(ln);
      form1.selUser.multiple = false;
      while (ln--)
        form1.selUser.options.remove(ln);
    }
    </script>
      

  5.   

    form1.selUser.innerHTML = ""
      

  6.   

    <script>
    function delall(){
    var selUser=document.getElementsByName("selUser")for(i=0;i<selUser[0].length;i++){selUser[0].options[i]=new Option("","")}
    }
    </script>
    <select  name="selUser">
    <option name="1" value="1">1</option>
    <option name="2" value="2">2</option>
    <option name="3" value="3">3</option>
    <option name="4" value="4">4</option>
    <option name="5" value="5">5</option>
    <option name="6" value="5">6</option>
    </option>
    <input type="button" name="del" onclick="delall()" value="清除值">