You are here: irt.org | FAQ | JavaScript | Form | Q1611 [ previous next ]
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>