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

HTML onload Event Attribute

HTML onload Event Attribute

HTML Event Attributes HTML Event Attributes

Example

Run a JavaScript script when the document has finished loading:

Try it »


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the onload event attribute.


Definition and Usage

The onload attribute is triggered after the document object has finished loading.

onload is usually used in the element to execute a specified script after the page is fully loaded (including images, scripts, CSS files, etc.).


Differences between HTML 4.01 and HTML5

None.


Syntax

<

element

onload="

script

">

HTML Event Attributes HTML Event Attributes