zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    python note 30 断点续传
    python note 29 线程创建
    python note 28 socketserver
    python note 27 粘包
    python note 26 socket
    python note 25 约束
    Sed 用法
    python note 24 反射
    python note 23 组合
    python note 22 面向对象成员
  • 原文地址:https://www.cnblogs.com/zhengwei-cq/p/7084394.html
Copyright © 2011-2022 走看看