21 |
|
|
22 |
<p>The <code>innerHTML</code> of the list above is:</p> |
<p>The <code>innerHTML</code> of the list above is:</p> |
23 |
<pre id="test-source"></pre> |
<pre id="test-source"></pre> |
24 |
|
|
25 |
|
<p>The <code>innerHTML</code> of the list above is:</p> |
26 |
|
<pre id="test-source"></pre> |
27 |
|
|
28 |
|
|
29 |
|
<p>About the first <code>dd</code> element:</p> |
30 |
|
<ul id="test-nodes"> |
31 |
|
<li>[There is no child.]</li> |
32 |
|
</ul> |
33 |
|
|
34 |
<script type="text/javascript"> |
<script type="text/javascript"> |
35 |
|
var list = document.getElementById ('test-list'); |
36 |
document.getElementById ('test-source').appendChild |
document.getElementById ('test-source').appendChild |
37 |
(document.createTextNode (document.getElementById ('test-list').innerHTML)); |
(document.createTextNode (list.innerHTML)); |
38 |
|
|
39 |
|
var listc = list.getElementsByTagName ('dd')[0].childNodes; |
40 |
|
var ul = document.getElementById ('test-nodes'); |
41 |
|
if (listc.length > 0) { |
42 |
|
ul.textContent = ""; |
43 |
|
ul.innerText = ""; |
44 |
|
} |
45 |
|
for (var i = 0; listc.length > i; i++) { |
46 |
|
var listcn = listc[i]; |
47 |
|
var li = document.createElementNS ("http://www.w3.org/1999/xhtml", 'li'); |
48 |
|
li.appendChild (document.createTextNode |
49 |
|
(i + "th child is of type |" + listcn.nodeType + |
50 |
|
"| with name |" + listcn.nodeName + "|, value |" + |
51 |
|
listcn.nodeValue + "|.")); |
52 |
|
ul.appendChild (li); |
53 |
|
} |
54 |
</script> |
</script> |
55 |
|
|
56 |
<h2>Expected Result</h2> |
<h2>Expected Result</h2> |