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
  • 相关阅读:
    Spring (4)框架
    Spring (3)框架
    Spring (2)框架
    javaSE面试题总结 java面试题总结
    分层结构
    三次握手
    17_网络编程
    16_多线程
    Ecplise中指定tomcat里Web项目发布文件
    Web 项目没有发布到我们安装的tomcat目录下
  • 原文地址:https://www.cnblogs.com/zhengwei-cq/p/7084394.html
Copyright © 2011-2022 走看看