JavaScript DHTML/Node Operation/childNodes — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 10:25, 26 мая 2010
Deal with nested nodes
<source lang="html4strict">
<html> <head> <title>The Node</title> <script type="text/javascript"> function outputNodeProps(nd) {
if (nd.style) { nd.style.backgroundColor="red"; } var children = nd.childNodes; for(var i=0; i < children.length; i++) { outputNodeProps(children[i]); }
} </script> <body onload="outputNodeProps(document)">
Header
P1.
P2
Header 2
P1.
P2
</body> </html>
</source>