asp.net使用jQuery获取RadioButtonList成员选中内容和值示例
更新时间:2014年01月13日 11:30:01 作者:
这篇文章主要介绍了通过jQuery来获取RadioButtonList成员内容的方法,大家参考使用吧
复制代码 代码如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Web.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="jquery-1.8.2.min.js" type="text/javascript"></script>
<link href="Base.css" rel="stylesheet" type="text/css" />
<style type="text/css">
</style>
<script type="text/javascript">
$(document).ready(function () {
$("#<%=rblHobbies.ClientID%> input[type=radio]").bind("change", function () {
if ($(this).val() != "") {
$("#message").text("Text:" + $(this).next().text() + " Value:"+$(this).val());
}
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div style="margin: 100px auto; width: 400px; height: 200px;">
<fieldset style="width: 400px; height: 150px">
<p>
请选择爱好</p>
<asp:RadioButtonList ID="rblHobbies" runat="server" >
<asp:ListItem Value="1">音乐</asp:ListItem>
<asp:ListItem Value="2">篮球</asp:ListItem>
<asp:ListItem Value="3">美剧</asp:ListItem>
<asp:ListItem Value="4">电影</asp:ListItem>
</asp:RadioButtonList >
</fieldset>
<br />
<div id="message" style="color:blue;"></div>
</div>
</form>
</body>
</html>
相关文章
使用 ServiceStack.Text 序列化 json的实现代码
今天发篇文章总结下自己使用 ServiceStack.Text 来序列化 json。它的速度比 Newtonsoft.Json 快很多,在测试时发现比 fastJson 还快些2013-06-06
ASP.NET(C#) Web Api通过文件流下载文件的实例
这篇文章主要介绍了ASP.NET(C#) Web Api通过文件流下载文件的方法,提供源码下载,需要的朋友可以参考下。2016-06-06
SQL Server 2008 R2:error 26 开启远程连接详解
本篇文章小编为大家介绍,SQL Server 2008 R2:error 26 开启远程连接详解。需要的朋友参考下2013-04-04
.Net Core3.0 WebApi 项目框架搭建之使用Serilog替换掉Log4j
Serilog 是一个用于.NET应用程序的日志记录开源库,配置简单,接口干净,并可运行在最新的.NET平台上,这篇文章主要介绍了.Net Core3.0 WebApi 项目框架搭建之使用Serilog替换掉Log4j,需要的朋友可以参考下2022-02-02
Asp.Net Core配置多环境log4net配置文件的全过程
在.NET世界中有非常多的日志框架,然而log4net是目前为止最流行的一款日志框架,下面这篇文章主要给大家介绍了关于Asp.Net Core配置多环境log4net配置文件的相关资料,需要的朋友可以参考下2022-04-04
根据身份证号码计算出生日期、年龄、性别(18位) 根据入职时间计算工龄
根据身份证号码计算出生日期、年龄、性别(18位);根据入职时间计算工龄实现代码,需要的朋友可以参考下2012-10-10


最新评论