+ 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?
2 ответов
+ 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.
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.