Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cursor placement in a form

Status
Not open for further replies.

dillpick6

Programmer
Jun 5, 2003
11
US
I have a form and when a visitor comes to my page, I want to have their cursor in a certain text box. How would I specifiy this default text box so their cursor is there when they first arrive?
 
you can use a combination of focus() (javascript) and the tabindex (IE only I believe)

onLoad of the page simply do a
document.form name.field name.focus()

eg:
<body onLoad=&quot;documentmyForm.myText.focus()&quot;>

That will focus the field you specify.

_____________________________________________________________________
[sub]You can accomplish anything in life, provided that you do not mind who gets credit.
Harry S. Truman[/sub]
onpnt2.gif

 
typo: missing &quot;.&quot;

<body onLoad=&quot;document.myForm.myText.focus()&quot;>

_____________________________________________________________________
[sub]You can accomplish anything in life, provided that you do not mind who gets credit.
Harry S. Truman[/sub]
onpnt2.gif

 
Do you know of any solutions without java by any chance? I didnt think there would be one, but thank you very much!
 
[smile]

_____________________________________________________________________
[sub]You can accomplish anything in life, provided that you do not mind who gets credit.
Harry S. Truman[/sub]
onpnt2.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top