<%@ page language="c#" autoeventwireup="true" codebehind="jquery4.asp教程x.cs" inherits="jquery_1.jquery4" %>
<!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>jquery给控件赋值 www.111cn.net</title>
<script type="text/网页特效" src="网页特效/jquery-1.3.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
alert("aa");
var v1 = "2";
var v2 = "2";
var v3 = "abc";
var v4 = "lab";
var v5 = "lit";
$("input[name='rdo'][value=1]").attr("checked", true);
//这里的input 后面不能有空格,如果有空格,则不能赋值
//value后面不用引号
$("#s1").val(v2);
$("#ipt").val(v3);
$("#lab1").text(v4);
//这里必须是html或者text如果用val()这不能显示任何内容
$("#lit1").html(v5);
//这里不能显示任何东西,因为literal在客户端不会解析成任何标签
//这里特意拿出来就是为了提醒大家
//<span></span>标签和label是一样的
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<!--radio-->
a<input type="radio" name="rdo" id="r1" value="0" />
b<input type="radio" name="rdo" id="r2" value="1" />
c<input type="radio" name="rdo" id="r3" value="2" />
<!--select-->
<select id="s1">
<option value="0">11</option>
<option value="1" selected="selected">22</option>
<option value="2">33</option>
<option value="3">44</option>
</select>
<!--input-->
<input type="text" id="ipt" />
<asp:label id="lab1" runat="server"></asp:label>
<asp:literal id="lit1" runat="server"></asp:literal>
</div>
</form>
</body>
</html>