+ 9
How to use window.onload in JavaScript
Whenever I use window.onload it acts really weird --It don't work when I use a function inside it but sometimes it do work atleast in other people's code What's the right way to use it ?
1 Answer
+ 15
window.onload = func; <-- correct
window.onload = function(){func();}; <-- correct
window.onload = func(); <-- wrong