HOW TO control the timing of window.onload event

The Javascript window.onload event fires AFTER all page content including any page elements like bulky images, have loaded. As the DOM is not fully loaded until then, any script written to achieve some UI effect on the page elements on page load may not have the desired impact.

To correct this aberration, there are 2 good solutions.

The solution by Peter-Paul Koch uses inline Javascript & CSS and the other by Dean Edwards uses conditional compilation (available through HTML & JScript in IE) and the defer attribute (a HTML 4.0 property available in IE) of the SCRIPT tag.

Comments