<script>
//品牌中,选择其它,出现其它品牌输入框
function enterOtherBrand()
{
var       lista=document.getElementsByName("Brand");
var       otherBrand=document.getElementById("OtherBrand");
if(lista[0].selectedIndex == 1)
{
otherBrand.style.display = "";
}
else
{
otherBrand.style.display = "none";
}
alert(lista[0].selectedIndex)
}
</script>
<select id="brand" name="brand" onChange="enterOtherBrand();">
<option value="">无</option>
<option value="其它">其它</option>
<option value="迪斯尼(Disney)">迪斯尼(Disney)</option>
<option value="小熊维尼(Winnie the Pooh)">小熊维尼(Winnie the Pooh)</option>
<option value="米老鼠(Mickey Mouse">米老鼠(Mickey Mouse)</option>
<option value="米老鼠/米奇(Mickey)">米老鼠/米奇(Mickey)</option>
<option value="米老鼠/米妮(Minnie)">米老鼠/米妮(Minnie)</option>
<option value="公主系列">公主系列</option>
<option value="史努比(Snoopy)">史努比(Snoopy)</option>
<option value="Kitty猫(Hello Kitty)">Kitty猫(Hello Kitty)</option>
<option value="机器猫(DORAEMON)">机器猫(DORAEMON)</option>
<option value="曼秀雷敦(Mentholatum)">曼秀雷敦(Mentholatum)</option>
<option value="尼维雅(NEVIA)">尼维雅(NEVIA)</option>
<option value="依莎yisa">依莎yisa</option>
</select>
<input id="OtherBrand" name="OtherBrand" style="display:none;" />

解决方案 »

  1.   

    function   enterOtherBrand() 

    var lista=document.getElementsByName("Brand"); 
    var otherBrand=document.getElementById("OtherBrand"); 
    if(listaselectedIndex == 1) //不是lista[0],是lista.selectedIndex

    otherBrand.style.display = ""; 

    else 

    otherBrand.style.display = "none"; 

    alert(lista.selectedIndex) //不是lista[0],是lista.selectedIndex
      

  2.   

    ================搞错,更正================function   enterOtherBrand() 

    var lista=document.getElementsByName("brand"); //是小写,没区分大小写
    var otherBrand=document.getElementById("OtherBrand"); 
    if(lista[0].selectedIndex == 1) 

    otherBrand.style.display = ""; 

    else 

    otherBrand.style.display = "none"; 

    alert(lista[0].selectedIndex) 

      

  3.   

    谢谢showbo
    确实是我不小心搞错大小写了,郁闷。不过IE与FF兼容问题确实不少,比如我今天做了一个上传图片本地图片预览,在IE可行,在FF不行。