Why you should stop using onload method.
Feb 01
Javascript, Web Development focus, Javascript, jQuery, JS, onload 8 Comments
It is amazing that many web developers still use onload method embedded in the BODY tag, like
<HEAD>
<BODY onload="document.contact.userID.focus();">
<form name="contact">
<input type="text" name="userID" >
</form>
</BODY>
</HEAD>
There are two problems with this line of code.
- Embedding code (behavior) with HTML (structure) makes it difficult to maintain the page.
- onload() method will executes only after the page is fully displayed.
Let’s see how to fix these problems. More







