window.onload example 4 | WebReference

window.onload example 4

window.onload example 4

This example uses an external script specified by writing out a script tag with src via document.write in the body tag.

Note that the assignment to window.onload = init; occurs outside of the script block where the script tag is written out.