How to get text box to be OnFocus on page load

D

Dianne

When the user opens the .asp page, I want the cursor to be in the first
textbox. The user should not have click inside the text box before starting
to type. Any ideas? Thanks.
 
J

Jon Spivey

Hi Dianne

Make your body tag like this
<body onload="document.forms[0].elements[0].focus();">
....your page
</body>
 
D

Dianne

I wasn't able to get this to work, but the JavaScript from Kathleen Anderson
did it for me. Thanks for trying.

Jon Spivey said:
Hi Dianne

Make your body tag like this
<body onload="document.forms[0].elements[0].focus();">
....your page
</body>

--
Cheers,
Jon
Microsoft MVP

Dianne said:
When the user opens the .asp page, I want the cursor to be in the first
textbox. The user should not have click inside the text box before
starting
to type. Any ideas? Thanks.
 
D

Dianne

This worked! Thank you. My next challenge will be to allow the user to use
the Enter key to move to subsequent textboxes, rather than the Tab key. I
will try to find it on the JavaScript site you recommended.
Dianne
 
S

Stefan B Rusynko

See http://irt.org/script/1179.htm or apply FP Form field validation to at least the last field

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


| This worked! Thank you. My next challenge will be to allow the user to use
| the Enter key to move to subsequent textboxes, rather than the Tab key. I
| will try to find it on the JavaScript site you recommended.
| Dianne
|
| "Kathleen Anderson [MVP - FrontPage]" wrote:
|
| > http://javascript.internet.com/forms/field-focus.html A simple and small
| > script to place focus on any form element you want when a page loads.
| >
| > --
| >
| > ~ Kathleen Anderson
| > Microsoft MVP - FrontPage
| > Spider Web Woman Designs
| > web: http://www.spiderwebwoman.com/resources/
| >
| >
| > | > > When the user opens the .asp page, I want the cursor to be in the first
| > > textbox. The user should not have click inside the text box before
| > > starting
| > > to type. Any ideas? Thanks.
| >
| >
| >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top