Page 1 of 1

Posted: Wed 05 May, 2004 17.43
by James Hatts
add

onfocus="this.blur()"

to the text input

Posted: Thu 06 May, 2004 07.55
by SteveL
If you want to, you can make it so that if the user doesn't enter anything in the box the text re-appears after they click off it, by adding the below to the text box:

onBlur="if(this.value==''){this.value='Text';}" onFocus="if(this.value=='Text'){this.value='';}"

(Change Text to the initial text the box will be displaying).

Posted: Thu 06 May, 2004 19.12
by Asa
Can anyone go one stage further and have it so the text is initially a light grey but changes to black when someone clicks/starts typing in the box?

Cheers, Asa

Posted: Thu 13 May, 2004 19.58
by Andrew Wood
Asa wrote:Can anyone go one stage further and have it so the text is initially a light grey but changes to black when someone clicks/starts typing in the box?

Cheers, Asa
<pre><style type="text/css">
#a {color: #999999;}
</style>
<form>
<input type="text" id="a" length="30" onBlur="this.style.color='#999999';if(this.value==''){this.value='Text';}"
onFocus="this.style.color='#000000';if(this.value=='Text'){this.value='';}"><br>
</form>
</pre>

Regards,
Andrew