JavaScript Event Onload | Onload Event in JS Tutorial By WDH

JavaScript Event Onload

JavaScript Onload
In this tutorial you can learn about JavaScript onload Event, With the help of The browser has finished loading the page.
In HTML, the onload attribute fires when an object has been loaded. The purpose of this attribute is to execute a script when the associated element loads.
The Syntax of onload event is as follows :
 window.onload = function your_function_name() {//code}
After clicking ok button
What is an Event
  • JavaScript interaction with HTML handled through events.
  • When the page loads, it is called an event. When the user clicks too is an event. Other examples include events like pressing any key, closing a Window, resizing a Window, etc.
  • HTML events are “things” that happen to html elements.
  • When JavaScript is used in HTML pages, Java can “react” to these events.