View Full Version : Pre "HIGHLIGHT"ing in a TEXT FIELD??

10-20-2003, 10:15 PM
What I am doing, is if you click on a drop down list,
the first selection is "--NOT IN LIST--", I have an
OnBlur routine that checks the value of the select
list for the above.

If it is "Not in list", it hides the drop down list, then
unhides a text box that will allow you to type in
the Entry that is not in the list.

I am currently filling the text with "Enter .... Here",

All works great.

Except....you have to highlight the "Enter...Here" first
and either start typing or hit <del> then type.

Is there a way to make the text already highlighted,
so once the user types the first character, the
"Enter....Here" disappears?

Or, am I going to have to use a OnKeyDown() routine to
do this?


10-21-2003, 01:17 AM
Try this for your textbox:
<input type="text" onfocus="this.value='';" value="Start here"> :D

Willy Duitt
10-21-2003, 01:45 AM
I think your looking for focus() and select()

<form name="WordForm">
<input type="text" size="100" onMouseover="focus();select()" value="Test focus, select">


10-21-2003, 02:37 PM
YES. select() is what I wanted.

Thank you.

I've seen it used before, but never realized what
it did. I thought it was just a cross browser of