有两个单选框A,B,一个复选框C。
想实现的效果是:当选择其中一个单选框A时,复选框C才可选。不知如何实现?谢谢了。。javascript

解决方案 »

  1.   


    <!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" />
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
    <title>无标题文档</title>
    </head><body>
    <input type="radio" value="a" name="sc" />A
    <input type="radio" value="b" name="sc" />B<input type="checkbox" value="is" name="msc" disabled="disabled" />choose A Or B
    <script type="text/javascript">
    jQuery(function($){
    $(':radio[name=sc]').click(function(){
    $(':checkbox[name=msc]').removeAttr('disabled');
    });
    });
    </script>
    </body>
    </html>
      

  2.   


    测试了下,好像不行哦,http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js这个文件我没有哦。。
      

  3.   


    测试了下,好像不行哦,http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js这个文件我没有哦。。
    你的电脑上不了网?这个是google jquery 的cdn地址。不需要你本地有。只要你能上网,浏览器没有禁用javascript脚本
      

  4.   


    测试了下,好像不行哦,http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js这个文件我没有哦。。
    你的电脑上不了网?这个是google jquery 的cdn地址。不需要你本地有。只要你能上网,浏览器没有禁用javascript脚本
    能上网啊。。没有禁用js脚本啊,我自己写的都可以用的。。
      

  5.   

    jQuery(function($){
        $(':radio[value=a]').click(function(){
            $(':checkbox[name=msc]').removeAttr('disabled');
        });  
    $(':radio[value=b]').click(function(){
            $(':checkbox[name=msc]').attr('disabled','disabled');
        }); 
    });是不是要这个样子的?按我自己的理解改的代码。
      

  6.   

    没使用JQuery,已经自己搞定了,谢谢各位!