1 |
wakaba |
1.1 |
<!DOCTYPE HTML> |
2 |
|
|
<html> |
3 |
|
|
<head> |
4 |
|
|
<title>Original document — setDocument</title> |
5 |
|
|
</head> |
6 |
|
|
<body> |
7 |
|
|
|
8 |
|
|
<p><code>window.xxxxx = 12345;</code></p> |
9 |
|
|
<script> |
10 |
|
|
window.xxxxx = 12345; |
11 |
|
|
</script> |
12 |
|
|
|
13 |
|
|
<p><input type=button value=setDocument onclick=" |
14 |
|
|
var doc = document.implementation.createDocument |
15 |
|
|
('http://www.w3.org/1999/xhtml', 'html', null); |
16 |
|
|
var html = doc.documentElement; |
17 |
|
|
html.appendChild (doc.createElementNS ('http://www.w3.org/1999/xhtml', 'head')) |
18 |
|
|
.appendChild (doc.createElementNS ('http://www.w3.org/1999/xhtml', 'title')) |
19 |
|
|
.textContent = 'New document'; |
20 |
|
|
var body = html.appendChild (doc.createElementNS ('http://www.w3.org/1999/xhtml', 'body')); |
21 |
|
|
body.appendChild (doc.createElementNS ('http://www.w3.org/1999/xhtml', 'p')) |
22 |
|
|
.textContent = 'New document.'; |
23 |
|
|
var button = body.appendChild (doc.createElementNS ('http://www.w3.org/1999/xhtml', 'p')) |
24 |
|
|
.appendChild (doc.createElementNS ('http://www.w3.org/1999/xhtml', 'button')); |
25 |
|
|
button.textContent = 'alert (window.xxxxx)'; |
26 |
|
|
button.onclick = 'alert (window.xxxxx)'; |
27 |
|
|
setDocument (doc); |
28 |
|
|
"></p> |
29 |
|
|
|
30 |
|
|
</body> |
31 |
|
|
</html> |