How do I set the initial focus on a form? I know it's probably easy. I just don't know how to do it.
For example: I have a page with a set of edit boxes, but I need to jump to a certain edit box initially?
John
Setting the focus on a form?
Moderator: General Moderators
a little focus for you
If you are using an onload event handler you can within it use
someFormName.someTextFieldName.focus()
with the .focus() doing the work of setting the cursor to that location.
Works well to direct people to the incorrect field when doing client side error checking.
phpScott
someFormName.someTextFieldName.focus()
with the .focus() doing the work of setting the cursor to that location.
Works well to direct people to the incorrect field when doing client side error checking.
phpScott
multipe onLoad events
What I usually do is if I have multpile functions to call when the page is loading is to create an intialize function that then calls all the other functions I need to run.
function initialize()
{
firstfunction();
secondfunction();
and the like
}
then in the onload event handler I just call the initialize function.
This allows for greater flexability in which functions you might want to call, it centralize them and takes a bunch of code out of the body tag
phpScott
function initialize()
{
firstfunction();
secondfunction();
and the like
}
then in the onload event handler I just call the initialize function.
This allows for greater flexability in which functions you might want to call, it centralize them and takes a bunch of code out of the body tag
phpScott