JavaScript: How to use onLoad event trigger in HTML and JavaScript (Tutorial)

Published: 08 January 2023
on channel: ViSIT
439
1

In this video, the speaker is explaining how to use the "on load" event in JavaScript. The "on load" event is triggered when an HTML element, such as the body tag, an iFrame, an image, a link, or a style, is loaded with content from an external source.

To demonstrate the use of the "on load" event, the speaker creates a new HTML file using Visual Studio Code and writes some basic HTML code to create a title, a heading, and a division tag. They then add a style tag to change the color of the heading to red and a script tag to write the JavaScript code.

The speaker defines a function named "loaded" that is called each time an HTML element is loaded. The function uses the "document.getElementById" method to access the division tag and the "innerHTML" property to add new text to the existing text inside the division tag. The speaker also adds the "loaded" function to the "on load" event of an element, in this case the body tag, so that the function is called each time the body tag is loaded.

The speaker then shows how to add a parameter to the "loaded" function to display the name of the element that has been loaded and uses this on the "on load" event of the style and iFrame tags. They also show how to add the "on load" event to an image tag and provide the URL for the image that is to be loaded.

In conclusion, the speaker explains that the "on load" event in JavaScript is used to confirm when an HTML element has been loaded and provides the name of the element that has been loaded. The video provides a good introduction to the "on load" event in JavaScript and how it can be used in HTML.

https://virtual-school.org/tutorial?v...

#javascript #webdevelopment #coding #programming #onloadevent #html #css #frontend #webdesign #webdev #devlife


Watch video JavaScript: How to use onLoad event trigger in HTML and JavaScript (Tutorial) online without registration, duration hours minute second in high quality. This video was added by user ViSIT 08 January 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 439 once and liked it 1 people.