HTML onload event Attribute

❮ HTML Event Attributes


<body onload="myFunction()">


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


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