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