It shows nothing because there is nothing to show. You should use the script at the bottom of a page that you want to generate a DOM script for, one with some content on it. Once you run it on a page like that, it will generate the DOM script for that page. Then you take this newly generated script and past that into your blank page's head to recreate the source page via the DOM.
Try this very simple example:
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>Hi</p>
<script type="text/javascript" src="http://home.comcast.net/~jscheuer1/side/DOM_b.js">
/*DOM_b - HTML page body generation script
*creation Wizard © John Davenport Scheuer
*Visit http://www.dynamicdrive.com/forums
*user name:jscheuer1 - This notice must remain for legal use */
</script>
</body>
</html>
It should generate a script like so, or equivalent (depending upon the browser):
Code:
<script type="text/javascript">
/*This DOM - HTML page body generation script was created using
*DOM_b - Page Body Generator Script Creation Wizard © John Davenport Scheuer
*Visit http://www.dynamicdrive.com/forums
*user name:jscheuer1 - This notice must remain for legal use. */
/*Run on Browser reported as: Operaź,
*userAgent: Opera/9.01 (Windows NT 5.1; U; en),
*vendor: NA
*Edited (yes/no)? No - If yes, by:?
*This notice must remain for legal use. */
function domit(){
// p ident="_node_1" children:
var text0=document.createTextNode("Hi");
// body children:
var p_node_1=document.createElement('p');
//appending elements:
p_node_1.appendChild(text0);
document.body.appendChild(p_node_1);
}
if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", domit, false );
else if ( typeof window.attachEvent != "undefined" )
window.attachEvent( "onload", domit );
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
domit();
};
}
else
window.onload = domit;
}
</script>
It is this new script that gets pasted to the head of a blank page.
Bookmarks