stop using "window.onload" in JavaScript | _ck_ says...
I don't write full blown AJAX but I do code some JavaScript from time to time. One big tip I can offer other "casual" javascript coders, since many times a script must be executed after a page is loaded, is to STOP using window.onload=your_function;
The reason for this is simple – you should be APPENDING your script to the page loaded hook, not CLOBBERING any existing scripts that may be already attached. The "window.onload" method can only hook one function at a time and these days it's common to use several third party scripts on a site. If you are not careful, you may be left scratching your head why something stopped working – because you accidentally stopped it from loading.
Read full article from stop using "window.onload" in JavaScript | _ck_ says...
No comments:
Post a Comment