案例:jquery案例     状态:可编辑再运行    进入横版
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="/js/jquery-1.11.1.min.js"></script>
5
<script>
6
$(document).ready(function(){
7
  $("#btn1").click(function(){
8
    $("#test1").text(function(i,origText){
9
      return "Old text: " + origText + " New text: Hello world! (index: " + i + ")"; 
10
    });
11
  });
12
13
  $("#btn2").click(function(){
14
    $("#test2").html(function(i,origText){
15
      return "Old html: " + origText + " New html: Hello <b>world!</b> (index: " + i + ")"; 
16
    });
17
  });
18
19
});
20
</script>
21
</head>
22
23
<body>
24
<p id="test1">这是<b>粗体</b>文本。</p>

 运行结果 
 北美留学生论坛