• RadioButtonList控件如何取得选中的值


    1、需求:我现在页面上有放两个单选控件,现在要通过判断不同的单选控件来对页面上的标签进行显示和隐藏操作

    2、控件如下

    <asp:RadioButtonList ID="rb_pumpParameter" TabIndex="1" runat="server" RepeatColumns="9" 
    RepeatDirection="Horizontal" RepeatLayout="Flow">
    <asp:ListItem onclick="pumpParameter();" Value="管式泵">管式泵</asp:ListItem>
        <asp:ListItem onclick="pumpParameter();" Value="抽稠泵">抽稠泵</asp:ListItem>
    </asp:RadioButtonList>
    View Code

    3、我在控件中都加了onclick方法,也就是单我选择这个控件时会走这个方法,在这个方法中我通过判断哪个按按钮被选中了,然后来进行我想要的操作,在这里我是对页面上的两个标签进行的隐藏,方法如下:

    function pumpParameter()
            {
                var rb_pump = document.getElementById("<%=rb_pumpParameter.ClientID%>");
                var radios = rb_pump.getElementsByTagName("INPUT");
                if (radios != null)
                {
                    for (var i = 0; i < radios.length; i++)
                    {
                       
                        if (radios[i].checked)
                        {
                            if (radios[i].value == "管式泵") {
                                $(".TubingPumpDiameter").css("display", "block");
                                $(".thickeningPumpDiameter").css("display","none");
                            } else {
                                $(".TubingPumpDiameter").css("display", "none");
                                $(".thickeningPumpDiameter").css("display", "block");
                            }                        
                        }        
                    }
                }
            }
    View Code
  • 相关阅读:
    16.14
    16.13
    JAVA JLabel自定义子类无法显示
    16.12
    16.11
    css实现垂直居中
    HTML5学习笔记
    HTML、Css中插入图片的一些问题
    MySQL的if函数
    java实现将汉字转为首字母、拼音
  • 原文地址:https://www.cnblogs.com/zhengwei-cq/p/7084394.html
Copyright © 2020-2023  润新知