-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|432|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Snippet Home -> Website Development


 
JL235
Created : 21 July 2010
 
Language : Java

onLoad events

a bit more durable then using the onLoad function

On HTML pages you can use the onLoad attribute on tags to have code run after the tag is complete. This can be inconvenient on complex sites and especially ones built across multiple files. This avoids having to manually tie your JavaScript to various onLoad attributes.

This is JavaScript code you import or place in your page and then from any section of JavaScript you can call 'addOnLoad' and pass in a function which will be run when the page has finished loading.

Code:


Example usage:

 

Comments