案例:jQuery案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript" src="/js/jquery.js"></script>
4
<script type="text/javascript">
5
$(document).ready(function(){
6
  $("button").click(function(){
7
    $("div").load("/example/xmle/cd_catalog.xml",function(response,status){
8
      if (status=="success")
9
      {
10
      $("div").html("<ol></ol>");
11
      $(response).find("artist").each(function(){
12
        var item_text = $(this).text();
13
        $('<li></li>').html(item_text).appendTo('ol');
14
        });
15
      alert("There are "+$(response).find("cd").size()+" CDs")
16
      }
17
    });
18
  });
19
});
20
</script>
21
</head>
22
<body>
23
<p>Artists</p>
24
<div></div>
25
<button>获得 CD 信息</button>
26
<p>本例中使用的 XML 文件是 <a href="/example/xmle/cd_catalog.xml" target="_blank">cd_catalog</a></p>
27
</body>
28
</html>
29