|
1 <html> |
|
2 <head> |
|
3 <title>Synchronized document.load() test</title> |
|
4 <style type="text/css"> |
|
5 .box { |
|
6 display: box; |
|
7 border: 1px solid black; |
|
8 margin-bottom: 0.5em; |
|
9 } |
|
10 .boxheader { |
|
11 font-weight: bold; |
|
12 color: maroon; |
|
13 } |
|
14 pre { |
|
15 margin-left: 2em; |
|
16 } |
|
17 </style> |
|
18 <script type="text/javascript"> |
|
19 var xmlDoc = document.implementation.createDocument("", "test", null); |
|
20 |
|
21 function documentLoaded(e) { |
|
22 var s = new XMLSerializer(); |
|
23 var str = s.serializeToString(xmlDoc); |
|
24 document.getElementById("id1").firstChild.nodeValue = str; |
|
25 var eventProperties = ""; |
|
26 for (prop in e) { |
|
27 eventProperties += prop + " : '" + e[prop] + "'\n"; |
|
28 } |
|
29 document.getElementById("id2").firstChild.nodeValue = |
|
30 "Event object: " + e + "\n" + |
|
31 "Event properties:\n" + |
|
32 eventProperties; |
|
33 } |
|
34 |
|
35 xmlDoc.addEventListener("load", documentLoaded, false); |
|
36 |
|
37 function execute() |
|
38 { |
|
39 xmlDoc.load("display.xml"); |
|
40 } |
|
41 |
|
42 </script> |
|
43 </head> |
|
44 <body onload="execute();"> |
|
45 <h1>Synchronized document.load() test</h1> |
|
46 |
|
47 <div class="box"><span class="boxheader">XML document serialized</span> |
|
48 <pre id="id1">@@No result@@</pre> |
|
49 </div> |
|
50 <div class="box"><span class="boxheader">Event information</span> |
|
51 <pre id="id2">@@No result@@</pre> |
|
52 </div> |
|
53 |
|
54 </body> |
|
55 </body> |
|
56 </html> |