如何在asp.net中使用javascript获取选定的单选按钮的ID [英] how to get id of a selected radio button using javascript in asp.net

查看:69
本文介绍了如何在asp.net中使用javascript获取选定的单选按钮的ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

i have two sets of radio buttons with group names of X and Y. in first set of radio button i have 5 radio buttons and in second set i have 2 radio buttons. My question is how to get the value or id of that radio button which i have clicked using java script and redirect that values to another page in asp.net..

my code of radio buttons as follows:

1st set of radio buttons:

<td width="60%" style="padding-bottom:10px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="10%" height="20" align="center"><label>
                          <asp:RadioButton ID="transactions" runat="server" GroupName="x"/>
                        </label></td>
                        <td width="90%" class="notxt">Transactions</td>
                      </tr>
                      <tr>
                        <td height="20" align="center"><asp:RadioButton ID="unsettled" runat="server" GroupName="x"/></td>
                        <td class="notxt"> Unsettled </td>
                      </tr>
                      <tr>
                        <td height="20" align="center"><asp:RadioButton ID="settled" runat="server" GroupName="x"/></td>
                        <td class="notxt"> Settled </td>
                      </tr>
                      <tr>
                        <td height="20" align="center"><asp:RadioButton ID="gaming" runat="server" GroupName="x"/></td>
                        <td class="notxt"> Gaming </td>
                      </tr>
                      <tr>
                        <td height="20" align="center"><asp:RadioButton ID="all" runat="server" GroupName="x"/></td>
                        <td class="notxt"> All (except Games)</td>
                      </tr>
                    </table></td>

2nd set of radio buttons:

<td width="60%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="10%" height="24" align="center"><asp:RadioButton ID="last" runat="server" GroupName="y"/></td>
                    <td width="90%">
                      <select name="select" class="lm1">
                        <option>Day</option>
                        <option>1week</option>
                        <option>2week</option>
                        <option>1month</option>
                        <option>2month</option>
                        <option>3month</option>
                        <option>6month</option>
                      </select></td>
                  </tr>
                </table></td>

<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td width="10%" height="24" align="center">
                        <asp:RadioButton ID="from" runat="server" GroupName="y"/>
                    </td>
                    <td width="15%" class="gtxt"><strong>From</strong></td>
                    <td width="75%">
                        <asp:TextBox ID="frmtxt" runat="server" CssClass="tf"></asp:TextBox>
                        <cc1:CalendarExtender ID="CalendarExtender1"

                     TargetControlID="frmtxt" Format="MM/dd/yyyy" runat="server">
                 </cc1:CalendarExtender>
                        </td>
                  </tr>
                </table></td>

推荐答案

<script type="text/javascript">
var id=document.getElementById(''ctl00_ContentPlaceHolder1_radiobutton'');
        </script>


这篇关于如何在asp.net中使用javascript获取选定的单选按钮的ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆