placing cursor in a form

Hey, not sure where this should be posted to but
here goes.  I have a page with a login form.  I have
noticed that when you go to some webpages, the developer
has done something that puts the site visitor's cursor
in the first field of the form, saving us the trouble of
having to tab to or click in the form field.  you can
just start typing.

I would like to do this in my form.  Is this a javascript
thing?  HTML?  Can someone tell me how this is done?

tia
LVL 1
altarEgoAsked:
Who is Participating?
 
knightEknightConnect With a Mentor Commented:
<BODY onLoad='document.nameOfYourForm.nameOfYourField.focus();'>
0
 
knightEknightCommented:

<BODY onLoad='document.myform.mytext1.focus();'>

<FORM name='myform'>
 <INPUT type='text' name='mytext1' value=''><BR>
 <INPUT type='text' name='mytext2' value=''><BR>
 <INPUT type='text' name='mytext3' value=''><BR>
</FORM>
0
All Courses

From novice to tech pro — start learning today.