想实现选择<=1年,月结 >= 60天/<60天 那个radiobutton不可用,选择> 1 年 ,月结 < 60 天 和月结 >= 60天 这两个radiobutton不可用。
以下是我实现的办法 在火狐下面没有问题 但是在ie上只要选择<=1年或者> 1 年的radiobutton下面三个全部不可用,再怎么点击都没有反应了,不知道什么原因 求大师帮忙。
contractApp.aspx
<asp:Content ID="Content1" ContentPlaceHolderID="CPH_Head" runat="Server">
<script type="text/javascript">
        function IsEnable() {
            $("#ctl00_WFContent2_rdPay1").attr("disabled", true);
            $("#ctl00_WFContent2_rdPay2").attr("disabled", true);
            $("#ctl00_WFContent2_rdPay3").attr("disabled", false);
            if ($("#ctl00_WFContent2_rdPay3")[0].checked) {
                $("#ctl00_WFContent2_rdPay3").removeAttr("checked");
            }
        }
        function IsDisEnable() {
            $("#ctl00_WFContent2_rdPay1").attr("disabled", false);
            $("#ctl00_WFContent2_rdPay2").attr("disabled", false);
            $("#ctl00_WFContent2_rdPay3").attr("disabled", true);
            if ($("#ctl00_WFContent2_rdPay1")[0].checked) {
                $("#ctl00_WFContent2_rdPay1").removeAttr("checked");
            }
            else if ($("#ctl00_WFContent2_rdPay2")[0].checked) {
                $("#ctl00_WFContent2_rdPay2").removeAttr("checked");
            }
        }
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="WFContent2" runat="Server">
<asp:RadioButton ID="rdDate1" runat="server" GroupName="GroupCAppDate" Enabled="true" Text="<= 1年" />
<asp:RadioButton ID="rdDate2" runat="server" GroupName="GroupCAppDate" Enabled="true" Text="> 1 年" />
<asp:RadioButton ID="rdPay1" runat="server" GroupName="CAppPay" Enabled="true" Text="月结 < 60 天" />
<asp:RadioButton ID="rdPay2" runat="server" GroupName="CAppPay" Enabled="true" Text="月结 >= 60天" />
<asp:RadioButton ID="rdPay3" runat="server" GroupName="CAppPay" Enabled="true" Text="月结 >= 60天/<60天" />
</asp:Content>contractApp.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
        rdDate1.Attributes.Add("onclick", "IsEnable()");
        rdDate2.Attributes.Add("onclick", "IsDisEnable()");
}
jqueryradiobutton

解决方案 »

  1.   

    http://bbs.csdn.net/topics/390362473
      

  2.   

    <head runat="server">
        <title></title>
        <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                $("input[id$=rdDate1]").bind('click', function () {
                    $("input[id*=rdPay]").removeAttr("checked").attr('disabled', false);
                    $("input[id$=rdPay3]").attr('disabled', true);                
                })
                $("input[id$=rdDate2]").bind('click', function () {                
                    $("input[id*=rdPay]").removeAttr("checked").attr('disabled', false);
                    $("input[id$=rdPay1]").attr('disabled', true);
                    $("input[id$=rdPay2]").attr('disabled', true);                
                })
            });
        </script>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <table>
                <tr>
                    <td>
                        <asp:RadioButton ID="rdDate1" runat="server" GroupName="GroupCAppDate" Enabled="true"
                            Text="<= 1年" />
                        <asp:RadioButton ID="rdDate2" runat="server" GroupName="GroupCAppDate" Enabled="true"
                            Text="> 1 年" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:RadioButton ID="rdPay1" runat="server" GroupName="CAppPay" Enabled="true" Text="月结 < 60 天" />
                        <asp:RadioButton ID="rdPay2" runat="server" GroupName="CAppPay" Enabled="true" Text="月结 >= 60天" />
                        <asp:RadioButton ID="rdPay3" runat="server" GroupName="CAppPay" Enabled="true" Text="月结 >= 60天/<60天" />
                    </td>
                </tr>
            </table>
        </div>
        </form>
    </body>
    </html>
      

  3.   

    你的和我的是一个效果 选中上面任意两个radiobutton中的一个 下面三个radiobutton全部不可用,然后就不能恢复了,这个是在ie上出现的状况, 在火狐上没有问题。
      

  4.   

    你的和我的是一个效果 选中上面任意两个radiobutton中的一个 下面三个radiobutton全部不可用,然后就不能恢复了,这个是在ie上出现的状况, 在火狐上没有问题。
      

  5.   

     <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(function () {
                $("#<%=rdDate1.ClientID %>").bind('click',IsEnable);
                $("#<%=rdDate2.ClientID %>").bind('click',IsDisEnable);
            });         function aaa() {
                 alert("sss");
             } 
            function IsEnable() {
                $("#<%=rdPay1.ClientID %>").attr("disabled", true);
                $("#<%=rdPay2.ClientID %>").attr("disabled", true);
                $("#<%=rdPay3.ClientID %>").attr("disabled", false);
                if ($("#<%=rdPay3.ClientID %>")[0].checked) {
                    $("#<%=rdPay3.ClientID %>").removeAttr("checked");
                }
            }
            function IsDisEnable() {
                $("#<%=rdPay1.ClientID %>").attr("disabled", false);
                $("#<%=rdPay2.ClientID %>").attr("disabled", false);
                $("#<%=rdPay3.ClientID %>").attr("disabled", true);
                if ($("#<%=rdPay1.ClientID %>")[0].checked) {
                    $("#<%=rdPay1.ClientID %>").removeAttr("checked");
                }
                else if ($("#<%=rdPay2.ClientID %>")[0].checked) {
                    $("#<%=rdPay2.ClientID %>").removeAttr("checked");
                }
            } 
        </script>
        <asp:RadioButton ID="rdDate1" runat="server" GroupName="GroupCAppDate" Enabled="true"
            Text="<= 1年" />
        <asp:RadioButton ID="rdDate2" runat="server" GroupName="GroupCAppDate" Enabled="true"
            Text="> 1 年" />
        <asp:RadioButton ID="rdPay1" runat="server" GroupName="CAppPay" Enabled="true" Text="月结 < 60 天" />
        <asp:RadioButton ID="rdPay2" runat="server" GroupName="CAppPay" Enabled="true" Text="月结 >= 60天" />
        <asp:RadioButton ID="rdPay3" runat="server" GroupName="CAppPay" Enabled="true" Text="月结 >= 60天/<60天" />
      

  6.   

    我这里是ie6 sp3 和360安全浏览器上运行都不行
      

  7.   

    被引用的母版页有其他jquery代码,这个子页也有其他的jquery代码 它们互不影响 就是影响了我新添加的这段jquery代码