小弟不会js.....别拍我...下面是我写的函数 if (document.form1.SmallClassName.value=="")
{
alert("请先指定上级分类");
document.form1.threeClassName.clear() ;
return false;
}
<select name=SmallClassName size=11></select>
<select name=threeClassName size=11></select>

解决方案 »

  1.   


    document.getElementById('threeClassName').length = 0;//将长度设为0,就清空了.
      

  2.   


    <select name="SmallClassName"  onchange="test()">
        <option></option>
    <option>11</option>
        <option>22</option>
        <option>33</option>
      </select>
    function test(){
    alert("a")
    if (document.form1.SmallClassName.value=="")
    {
    alert("请先指定上级分类");
    //document.form1.SmallClassName.empty() ;
    document.form1.SmallClassName.innerHTML = "";//清空
    return false;
    }
    }
      

  3.   

    1L的 length = 0
    这样写最好
      

  4.   

    if (document.form1.SmallClassName.value=="")
    {
    alert("请先指定上级分类");
    document.form1.threeClassName.options.length=0 ;
    return false;
    }
      

  5.   

    document.getElementById("SmallClassName").length = 0;//将长度设为0,就清空了.