Tuesday, July 19, 2011

The value of the property 'LoadPage' is null or undefined, not a Function object

If you've used the tag. Internet Explorer versions below 9 will display the error:


"The value of the property 'LoadPage' is null or undefined, not a Function object"

Do not use the body onLoad. This tag is not compatible on older browsers.

The solution is to use this instead:

if ( window.addEventListener ) {
window.addEventListener( "load", LoadPage, false );
}
else
if ( window.attachEvent ) {
window.attachEvent( "onload", LoadPage );
} else
if ( window.onLoad ) {
window.onload = LoadPage;
}