<form name=theForm>
<select name=s020 onchange="if (theForm.s020.options[theForm.s020.selectedIndex].value=='a') {  theForm.s020_99.value=''; theForm.s020_99.disabled=true;} else theForm.s020_99.disabled=false;">
<option value="a">a</option>
<option value="b">b</option>
</select>
<input name="s020_99">
</form>

解决方案 »

  1.   

    select有selected属性,没有checked属性
      

  2.   

    select有selected属性,没有checked属性
      

  3.   

    例子:function CheckClick()
    {
    if (checkboxNever.checked == true)
    {
    document.all.DownloadTexts.style.color = "inactivecaption";
    document.all.downloadButtonbox.style.display = "none";
    document.all.OKButton.style.display = "";
    }
    else
    {
    document.all.DownloadTexts.style.color = "buttontext";
    document.all.downloadButtonbox.style.display = "";
    document.all.OKButton.style.display = "none";
    }
    }
      

  4.   

    <script>
    <!--
    function on_selected(theID) {
    switch(theID){
    case "o1":
    document.form1.t1.style.display="none";
    break;
    case "o2":
    document.form1.t2.style.display="none";
    break;
    case "o3":
    document.form1.t3.style.display="none";
    break;
    case "o4":
    document.form1.t4.style.display="none";
    break;
    default:
    }
    }
    //-->
    </script><form id="form1" name="form1">
    <select name="select1" id="select1" onchange="on_selected(this.value)">
    <option>请选择</option>
    <option name="o1" id="o1" value="o1">1</option>
    <option name="o2" id="o1" value="o2">2</option>
    <option name="o3" id="o3" value="o3">3</option>
    <option name="o4" id="o4" value="o4">4</option>
    </select>
    <br>
    <input name="t1" id="t1" value="t1" style="display:true;"><br>
    <input name="t2" id="t2" value="t2" style="display:true;"><br>
    <input name="t3" id="t3" value="t3" style="display:true;"><br>
    <input name="t4" id="t4" value="t4" style="display:true;"><br>
    </form>
      

  5.   

    奇怪,按照net_lover兄的写法没有成功!
    请教各位大虾,我现在想在下拉选项(s020)中增加一个选项为“其他”当未选中“其他”时,下面的文本框不可选,当选中其他时,该文本框可填写(s020_99)。
    SOS!老板急着要,我对javascript又不熟,救救我吧!!!!
      

  6.   

    <form name=theForm>
    <select name=s020 onchange="if (theForm.s020.options[theForm.s020.selectedIndex].value=='其他') {  theForm.s020_99.value=''; theForm.s020_99.disabled=false;} else theForm.s020_99.disabled=true;">
    <option value="a">a</option>
    <option value="b">b</option>
    <option value="其他">其他</option>
    </select>
    <input name="s020_99">
    </form>
      

  7.   

    <form name=theForm>
    <select name=s020 onchange="if (theForm.s020.options[theForm.s020.selectedIndex].value=='其他') {  theForm.s020_99.value=''; theForm.s020_99.disabled=false;} else theForm.s020_99.disabled=true;">
    <option value="a">a</option>
    <option value="b">b</option>
    <option value="其他">其他</option>
    </select>
    <input name="s020_99">
    </form>
      

  8.   

    <body onload="if(document.theForm.s020.options[document.theForm.s020.selectedIndex].value!='其他') document.theForm.s020_99.disabled=true;">
    <form name=theForm>
    <select name=s020 onchange="if (theForm.s020.options[theForm.s020.selectedIndex].value=='其他') {  theForm.s020_99.value=''; theForm.s020_99.disabled=false;} else theForm.s020_99.disabled=true;">
    <option value="a">a</option>
    <option value="b">b</option>
    <option value="其他">其他</option>
    </select>
    <input name="s020_99">
    </form>
      

  9.   

    net_lover的是可以的。<form name=theForm>
    <select name=s020 onchange="if (theForm.s020.options[theForm.s020.selectedIndex].value=='其他') {  theForm.s020_99.value=''; theForm.s020_99.disabled=true;} else theForm.s020_99.disabled=false;">
    <option value="其他">其他</option>
    <option value="a">a</option>
    <option value="b">b</option>
    </select>
    <input name="s020_99">
    </form>