通过css和javascript隐藏和显示asp.net单选按钮

通过css和javascript隐藏和显示asp.net单选按钮,javascript,asp.net,css,Javascript,Asp.net,Css,因此,我试图根据一个列表框的选择来隐藏和显示一些内容。我在加载页面时使用css隐藏一些内容,然后在选择某些内容时显示。大部分都能工作,但不明白为什么这些单选按钮不能显示 这是单选按钮和标签 <br /><!--View/Send By--> <asp:Label ID="lblViewSend" runat="server" Text="View/Send as" style="display:none;"></asp:L

因此,我试图根据一个列表框的选择来隐藏和显示一些内容。我在加载页面时使用css隐藏一些内容,然后在选择某些内容时显示。大部分都能工作,但不明白为什么这些单选按钮不能显示

这是单选按钮和标签

        <br /><!--View/Send By-->
        <asp:Label ID="lblViewSend" runat="server" Text="View/Send as" style="display:none;"></asp:Label>
        <asp:RadioButton ID="rdViewPrint" Text="View/Print" runat="server" OnClick="javascript:disableFields();" GroupName="viewSend" Checked="True" style="display:none; margin-left:10px;" />
        <asp:RadioButton ID="rdEmail" Text="Email" runat="server" OnClick="javascript:emailFields();" GroupName="viewSend" style="display:none; margin-left:10px;" />
        <asp:RadioButton ID="rdFax" Text="Fax" runat="server" OnClick="javascript:faxFields();" GroupName="viewSend" style="display:none; margin-left:10px;" />

在列表框中选择项目时显示它们的javascript

function lbSelected() {
             var sel = document.getElementById('<%=lbPatientVisits.ClientID%>');
             var listlength = sel.options.length;

             document.getElementById('<%=lblViewSend.ClientID%>').style.display = "inherit";
             document.getElementById('<%=rdViewPrint.ClientID%>').style.display = "inherit";
             document.getElementById('<%=rdEmail.ClientID%>').style.display = "inherit";
             document.getElementById('<%=rdFax.ClientID%>').style.display = "inherit";
//...plus more code that functions correctly...
    }
函数lbSelected(){
var sel=document.getElementById(“”);
var listlength=sel.options.length;
document.getElementById(“”).style.display=“继承”;
document.getElementById(“”).style.display=“继承”;
document.getElementById(“”).style.display=“继承”;
document.getElementById(“”).style.display=“继承”;
//…再加上更多正确运行的代码。。。
}
标签会在页面上显示,但单选按钮不会。我也尝试过这个作为一个小的变化,它也没有这样工作

var rbtn = document.getElementById('<%=rdViewPrint.ClientID%>');
         rbtn.style.display = 'inherit';
var rbtn=document.getElementById(“”);
rbtn.style.display='inherit';
我错过了什么或忽略了什么?该代码似乎适用于常规按钮和标签,但不适用于单选框?
感谢您的帮助。

这是使用jquery的完整示例:

<script type="text/javascript" src="Scripts/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
    $(function () {
        $("#name").click(function () {
            $("#<%=this.myRadio.ClientID %>").toggle();
        });
    });
</script>


    <asp:RadioButtonList runat="server" ID="myRadio">
        <asp:ListItem Text="text1" />
        <asp:ListItem Text="text2" />
    </asp:RadioButtonList>
    <input type="button" id="name" value="click me" />

$(函数(){
$(“#名称”)。单击(函数(){
$(“#”)切换();
});
});

basic$(“#yourId”).hide()/$(“#yourId”).show()对你不起作用吗?我认为他没有使用jQuery。Hanlet是正确的,没有使用jQuery。尝试一下设置单选按钮的
RepeatLayout=“Flow”
。我现在不想,也不想在此时添加jQuery。