<html> <head> <title>The Node</title> <script type="text/javascript"> function outputNodeProps(nd) { var strNode = "Node Type: " + nd.nodeType; strNode += "\nNode Name: " + nd.nodeName; strNode += "\nNode Value: " + nd.nodeValue; if (nd.style) { var clr = "red"; nd.style.backgroundColor=clr; strNode += "\nbackgroundColor: " + clr; } alert(strNode); } </script> <body onload="outputNodeProps(document)"> <div id="div1"> <h1>Header</h1> </div> </body> </html>