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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Set textbox value to blank 1

Status
Not open for further replies.

jmcg

Technical User
Jun 30, 2000
223
GB
Probably a simple question but know little about java.
I haver text box with a value="Enter search term", when the user click on this I want the text to disappear.
Can anyone help.
Cheers
 
Hi

Code:
[gray]// exactly what you asked for[/gray]
<input type="text" value="Enter search term" onfocus="this.value=''">

[gray]// empty only the default text[/gray]
<input type="text" value="Enter search term" onfocus="if(this.value=='Enter search term')this.value=''">

[gray]// restore the default text too[/gray]
<input type="text" value="Enter search term" onfocus="if(this.value=='Enter search term')this.value=''" onblur="if(this.value=='')this.value='Enter search term'">

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top