HTML onload event Attribute

❮ HTML Event Attributes

Example

<body onload="myFunction()">

Meaning

The onload attribute specifies the event of a window, image, link, script or frame set finishing the loading of a document.


Standard Syntax

<element onload="script">

Browser Support




Status







Attribute Values

Value Description
script Specifies the script to be run on onload



Technical Details

Supported HTML elements:

<body>, <frame>, <frameset>, <iframe>, <img>, <input type="image">, <link>, <script> and <style>
❮ HTML Event Attributes