[thelist] form field

.jeff jeff at members.evolt.org
Tue Nov 5 12:32:01 CST 2002


andrew,

><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> From: Andrew Maynes
>
> > > Ok heres another and I do 'not' have an idea about
> > > it.  How do I get the form field to clear and ready
> > > for the visitor to type into it... as soon as they
> > > click into the field?
>
> > <input type='text' value='Type Here'
> >  onfocus='this.value = ""' />
>
> works like a dream :)
><><><><><><><><><><><><><><><><><><><><><><><><><><><><><

it seems it would.  however, the solution above is a usability nightmare.
try this for yourself and see what i mean.  type something into the box.
switch to another window temporarily.  switch back to this window.  boom,
text is gone huh?

try this instead:

<input type="text" value="Type Here"
       onfocus="if(this.value == 'Type Here') this.value = ''" />

now it'll only clear the field if it contains the original value.

good luck,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/




More information about the thelist mailing list