1 <!DOCTYPE html>
2 <html>
3 <head>
4 <style>
5 h3 { margin: 0; }
6 div,span,p {
7 width: 80px;
8 height: 40px;
9 float:left;
10 padding: 10px;
11 margin: 10px;
12 background-color: #EEEEEE;
13 }
14 </style>
15 <script src="jquery-1.4.2.js"></script>
16 <script language="javascript">
17
18 var Wurl ="http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx/getRegionCountry";
19 $.post(Wurl, { "func": "getNameAndTime" },
20 function(data){
21 alert(data.xml); // John
22 //console.log(data.time); // 2pm
23 sltXML(data);
24 }, "xml");
25
26 function sltXML(data)
27 {
28 var country =$("#contry").get(0);
29 var conuntrys =data.getElementsByTagName("string");
30 for(var i=0;i<conuntrys.length;i++)
31 {
32 var con_code =conuntrys[i].childNodes[0].text.split(",");
33 var con =con_code[0];
34 var code=con_code[1];
35 var item =new Option(con ,code);
36 country.options[i]=item;
37
38
39 }
40
41 }
42
43 </script>
44 </head>
45 <body>
46 <div>DIV</div>
47
48 <span>SPAN</span>
49 <p id="u_l">P <button>Button</button></p>
50 <script>var elementCount = $("*").css("border","3px solid red").length;
51 $("body").prepend("<h3>" + elementCount + " elements found</h3>");</script>
52 <select id="contry">
53 <option value="ddd" selected>dddd</option>
54 </select>
55 </body>
56 </html>