Click to See Complete Forum and Search --> : Null/Not Object Error


Falconix
04-28-2003, 08:59 PM
Here's my code:

MainSect = document.getElementById("main");
MainSect.innerHTML = makeMain();

makeMain() returns a string holding some HTML. This gives me an error though... "'MainSect' is null or not an object". Why am I getting this? :D

gil davis
04-29-2003, 05:30 AM
Why am I getting this?Because the browser could not find an object in the document with an ID of "main".

If there is indeed an object with an ID of "main", it may not have existed at the time that the browser was evaluating the getElementById() function. It won't exist until the browser has read the part of your file that contains the object.