Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

onload event

onload event

Event Object Reference Event Object

Example

Execute JavaScript code when the page has finished loading:

Try it »

(See more examples at the bottom of the page)


Definition and Usage

The onload event occurs immediately after the page or image has finished loading.

onload is usually used on the element to execute script code after the page is fully loaded (including images, css files, etc.).

Syntax

In HTML:

FirefoxOperaGoogle ChromeSafari

All major browsers support the onload event


The following HTML tags support onload:

, , ,