Friday, November 25, 2011

JavaScript, set focus on document.form


Purpose: when the web page is loaded, set the focus on the subject of  the form,
i.e. the input field of  the subject in the form is blinking and ready to accept the text input.


<form name="testform">
<input type="text" name="subject">
</form>
 
Modify the body tag to:
<body OnLoad="document.testform.subject.focus();">

No comments:

Post a Comment