+ 4

Must I always call window.onload function in JavaScript? What's the work of it and what happens if I don't call it?

10th Jul 2018, 4:17 PM
Emeruche Ikenna Cole
Emeruche Ikenna Cole - avatar
2 Respuestas
+ 3
It makes something happend only when the window loads. Uses: I tried to create an HTML table dynamically with JS, and nothing happened because I was trying to modify the DOM before it loaded.
10th Jul 2018, 4:33 PM
Paul Grasser
Paul Grasser - avatar
0
No some scripts are triggered buy a user while performing an action like rollover the link or clicking a button. Window.onload means the function will be triggered when the browser finishes loading the html content to the screen.
17th Jul 2018, 7:37 PM
Joash N
Joash N - avatar