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

Pubblicato il: 08 gennaio 2023
sul canale di: 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


In questa pagina del sito puoi guardare il video online JavaScript: How to use onLoad event trigger in HTML and JavaScript (Tutorial) della durata di ore minuti seconda in buona qualità , che l'utente ha caricato ViSIT 08 gennaio 2023, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 439 volte e gli è piaciuto 1 spettatori. Buona visione!