一个单选框: " 是 否 "   两个选项
如果选 "是" 则可以填写是下面的文本框
如果选 "否" 则只能填否下面的也就是说先完成单选,才能填文本框,但是单选框与文本框都有与其对应的,不可以交叉选填能不能做到呢?请高人指点

解决方案 »

  1.   

    思路很简单,只要选"是"的就让文本框enable,否则一直不可用,按楼主的问题,"否"是多余了吧
      

  2.   

    方法和二楼一样,先让文本框都失效disabled=true;然后给单选按钮做相关的事件就可以了。
    再事件中,只要改变相关的文本框disabled="";就可以了。
      

  3.   

    radio1 默认选中
    radio2 默认没有选中
    div1 里面内容为是的内容 默认显示
    div2 里面内容为否的内容 默认不显示在 radio1和radio2上绑定click事件,
    点击radio1的时候,div1显示,div2隐藏,
    点击radio2的时候,div2显示,div1隐藏
      

  4.   


    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>ceshi</title>
    <style>
    </style>
    <script src="jquery-1.3.2.js"></script>
    <script>
    $(function(){ $("input[class=ok]").click(function(){
    if($(this).is(":checked")){
    $(this).next().next().attr("readonly",true).css("background","#ccc");
    $(this).next().attr("checked",false);
    }else{
    $(this).next().next().attr("readonly",false).css("background","#fff");
    $(this).next().attr("checked",true);
    }
    });
    $("input[class=no]").click(function(){
    if($(this).is(":checked")){
    $(this).next().attr("readonly",false).css("background","#fff");
    $(this).prev().attr("checked",false);
    }else{
    $(this).next().attr("readonly",true).css("background","#ccc");
    $(this).prev().attr("checked",true);
    }
    });
    });
    </script>
    </head><body>
    <div id="all">
    <div class="test">
         <input type="radio" class="ok" />是<input type="radio" class="no" />否
            <input type="text" class="text" />
        </div>
        <div class="test">
         <input type="radio" class="ok" />是<input type="radio" class="no" />否
            <input type="text" class="text" />
        </div>
        <div class="test">
         <input type="radio" class="ok" />是<input type="radio" class="no" />否
            <input type="text" class="text" />
        </div>
    </div></body>
    </html>
      

  5.   

    实现 按钮的onchange事件另外 不管 是 或者 否 都可以填一个文本框
    则 一组状态按钮 是|否  单独一个文本框  就可以了 不必搞这么复杂
      

  6.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    <script type="text/javascript">function btnClick(inputName, disableInputName) {
    var input = document.getElementById(inputName);
    var disableInputName = document.getElementById(disableInputName); input.disabled = false;
    disableInputName.disabled = true;
    }
    </script>
    </head>
    <body>
    <input type="radio" name="select" checked="true" onclick="btnClick('textYes', 'textNo')"></input>
    <input type="text" name="textYes"></input>
    <input type="radio" name="select" onclick="btnClick('textNo', 'textYes')"></input>
    <input type="text" name="textNo" disabled="true"></input></body>
    </html>
      

  7.   

    分给错了,rainsilence的是正确的。
    对不起啦