有三个单选框 a b 其它, 其它后面要有文本框,
1, 当点其它单选框时文本框可输入值, 当点a或b文本框不可用,
2,当点b时要控制一个下拉链表可用, 当点 a 和 其它 时下拉链表不可用.3,谢谢大家.

解决方案 »

  1.   

    对单选按钮添加onclick事件,在事件里根据情况设置文本框跟下拉列表的 disabled属性,例如点其它的时候
    document.getElementById("textId").disabled =false;
    document.getElementById("selectId").disabled =true;
      

  2.   

    贴代码:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">
      <script>
    function _change(obj){
    if(obj.value == 'other')
    document.getElementById("othertxt").disabled=false;
    else 
    document.getElementById("othertxt").disabled=true;
    if(obj.value == 'b')
    document.getElementById("ms").disabled=false;
    else
    document.getElementById("ms").disabled=true;
    }
      </script>
     </HEAD> <BODY>
    <input type="radio" name="ra" id="ra" onclick="_change(this);" value="a"/> a 
    <input type="radio" name="ra" id="ra" onclick="_change(this);" value="b"/> b 
    <input type="radio" name="ra" id="ra" onclick="_change(this);" value="other"/> 其他 <input type="text" name="othertxt" id="othertxt" disabled/>
    <select id="ms" name="ms" disabled>
    <option name="a">下拉列表a</option>
    <option name="b">下拉列表b</option>
    <option name="c">下拉列表c</option>
    </select>
     </BODY>
    </HTML>
      

  3.   

    jquery版<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">
      <script src="jquery.js"></script>
      <script>
       $(function(){
       $("input[name='ra']").click(function(){
       _change($(this));
       });
      
       });
          function _change(obj){
              if(obj.val() == 'other'){
               $("#othertxt").attr("disabled",false);
              }
              else {
               $("#othertxt").val("").attr("disabled",true);            
              }
              if(obj.val() == 'b'){
               $("#ms").attr("disabled",false);            
              }
              else{
               $("#ms").attr("disabled",true);            
              }
          }
      </script>
     </HEAD> <BODY>
        <input type="radio" name="ra" id="ra1" value="a"/> a 
        <input type="radio" name="ra" id="ra2" value="b"/> b 
        <input type="radio" name="ra" id="ra3" value="other"/> 
        其他 <input type="text" name="othertxt" id="othertxt" disabled/>
        <select id="ms" name="ms" disabled>
            <option name="a">下拉列表a</option>
            <option name="b">下拉列表b</option>
            <option name="c">下拉列表c</option>
        </select>
     </BODY>
    </HTML>
      

  4.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <TITLE> New Document </TITLE>
      <META NAME="Generator" CONTENT="EditPlus">
      <META NAME="Author" CONTENT="">
      <META NAME="Keywords" CONTENT="">
      <META NAME="Description" CONTENT="">
      <script>
            function _change(obj){
                if(obj.value == 'other')
                    document.getElementById("othertxt").disabled=false;
                else 
                    document.getElementById("othertxt").disabled=true;
                if(obj.value == 'b')
                    document.getElementById("ms").disabled=false;
                else
                    document.getElementById("ms").disabled=true;
            }
      </script>
     </HEAD> <BODY>
        <input type="radio" name="ra" id="ra" onclick="_change(this);" value="a"/> a 
        <input type="radio" name="ra" id="ra" onclick="_change(this);" value="b"/> b 
        <input type="radio" name="ra" id="ra" onclick="_change(this);" value="other"/> 其他 <input type="text" name="othertxt" id="othertxt" disabled/>
        <select id="ms" name="ms" disabled>
            <option name="a">下拉列表a</option>
            <option name="b">下拉列表b</option>
            <option name="c">下拉列表c</option>
        </select>
     </BODY>
    </HTML>