Do you have a question? Post it now! No Registration Necessary. Now with pictures!
May 8, 2006, 12:50 am
rate this thread
Re: Default input
Normally your question would be answered by saying that you specify the
default value for a text input field in the value="..." attribute.
Apparently, you meant to ask how to make a text input field _focused_
when a page is entered.
The short answer is: Don't.
The longer answer is: You shouldn't, because the user may enter some
input into the field _before_ your client-side script manages to focus
on it. (There's no other way to focus on it than client-side scripting.)
Now imagine yourself typing "foobar" and having just "bar" entered,
since after you had typed "foo", the field was focused, thereby
selecting the text in it, and then the characters "bar" _replaced_ the