HTML onload Attribute

❮ HTML 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




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






Attribute Values

Value Description
script Specifies the script to be run on onload
❮ HTML Attributes