Click to See Complete Forum and Search --> : trouble in setting focus


rjusa
11-10-2003, 10:30 AM
when my form loads I would like the focus to be set in the first field, "FirstNameFI"...I tried the following:

</script>

<script language="JavaScript">
window.onload=FocusField
function FocusField() {
document.form.FirstNameFI.focus();
}
</script>

didn't work, suggestions please.

Thanks,
Ron

requestcode
11-10-2003, 11:33 AM
If the form is the only one on the page or is the first one then try this:
document.forms[0].FirstNameFI.focus();

Also try moving the window.onload statement to after the function. You could also use the onLoad event in the body tag like this:
<body onLoad="document.forms[0].FirstNameFI.focus()">