function showDOM var win open width 500 height 500 win document write

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
function showDOM() {
var win = open('','','width=500, height=500'); win.document.write('<html><body>'); showChildNodes(document.documentElement, win.document); win.document.write('</body></html>');
}
function showChildNodes(node, doc) {
if(node.nodeType == 3){
doc.write(node.nodeValue);
} else if (node.nodeType == 1) {
doc.write('<blockquote>');
doc.write(node.nodeName);
for(var i = 0; i < node.childNodes.length; i++){
showChildNodes(node.childNodes[i], doc);
}
doc.write('</blockquote>');
}
}