1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml">
3 <head>
4 <title></title>
5 <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
6 <script type="text/javascript">
7 $(function () {
8 //设置文本居中
9 $("#text").css("text-align", "center");
10 $("#getInnerText").click(function () {
11 alert($("#text").text());
12 });
13 $("#getInnerHtml").click(function () {
14 alert($("#text").html());
15 });
16 $("#change").hide().show("5000").click(function () {
17 $("#text").html("当前时间是:" + new Date());
18 });
19 })
20 </script>
21 </head>
22 <body>
23 <p id="text">这是<font color="red">测试</font>文本</p>
24 <input id="getInnerText" type="button" value="获得InnerText" />
25 <input id="getInnerHtml" type="button" value="获得InnerHtml" />
26 <input id="change" type="button" value="改变文本值" />
27 </body>
28 </html>
My New Blog : http://blog.fdlife.info/
The more you know, the less you believe.