Easy Tutorial
❮ Jsref Strike Prop Source Type ❯

onload Event

Event Object

Example

Execute JavaScript code after the page has fully loaded:


Definition and Usage

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

onload is commonly used with the <body> element to execute script code after the page has fully loaded, including images and CSS files.

Syntax

In HTML:

In JavaScript:

Parameter Description
SomeJavaScriptCode Required. The JavaScript to be executed when the event occurs.

Browser Support

All major browsers support the onload event.


HTML Tags That Support onload


More Examples

Using onload with <img>


❮ Jsref Strike Prop Source Type ❯