Try it yourself »
(more examples at the bottom of this page)
Definition and Usage
The onload event occurs when an object has been loaded.
onload is most often used within the <body> element to execute a script once a web page has completely loaded all content (including images, script files, CSS files, etc.).
The onload event is supported in all major browsers.
onload is Supported by the Following HTML Tags:
Try it Yourself - Examples
onload on <img>
Alert "Image is loaded" immediately after an image has been loaded.
Thank You For Helping Us!
Your message has been sent to W3Schools.