Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1611 How do I position the cursor on the first field of the first form when a page loads?

irt.org | Knowledge Base | JavaScript | Form | Q1611 [ previous next ]

Q1611 How do I position the cursor on the first field of the first form when a page loads?

Using a named form and a named form field:

<body onLoad="document.myForm.myField.focus()">

<form name="myForm">
<input type="text" name="myField">
</form>

When the form and field names are not known then:

<body onLoad="document.forms[0].elements[0].focus()">

<form>
<input type="text">
</form>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.