Skip to content Skip to sidebar Skip to footer

CreateHTMLDocument() Does Not Initialize

I'm new to JavaScript and HTML5 and today I was playing with createHTMLDocument() and I ran into a frustrating problem. I got the following snippet from Mozilla's site:

Solution 1:

If you want to call a javascript function that manipulates the DOM you should use an onload event handler.

Try adding

<body onload="makeDocument()">

instead of calling the function directly in your script tag.

Browsers are multi-threaded so you cannot guarantee that the DOM is done loading even though the script tag is after the iframe definition.


Post a Comment for "CreateHTMLDocument() Does Not Initialize"