HTML onload Attribute
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">
Applies to:
The onload attribute can be used on the following element:
| Element | Attribute |
|---|---|
| <body> | onload |
| <iframe> | onload |
| <img> | onload |
| <input> | onload |
| <link> | onload |
| <script> | onload |
| <style> | onload |
Advertisement
Attribute Values
| Value | Description |
|---|---|
| script | Specifies the script to be run on onload |