![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi there, Does anyone know of an extension or code snippet, that will clear the text field of its current value when you click on it? Kind regards, Steve I should really search first, then post, as I just found the answer: |

#3
| |||
| |||
|
|
Dooza wrote: Hi there, Does anyone know of an extension or code snippet, that will clear the text field of its current value when you click on it? Kind regards, Steve I should really search first, then post, as I just found the answer: function clearDefault(el) { if (el.defaultValue==el.value) el.value = "" } Next, you need to call this script from the onfocus event of your input text box: E-Mail: INPUT TYPE=text VALUE="E-Mail Address" ONFOCUS="clearDefault(this)" Hopefully this will help someone else ![]() Steve |
#4
| |||
| |||
|
|
Hey - use this: input type="text" name="n" value="Your message" onFocus="if(this.value==this.defaultValue)this.val ue=''" onBlur="if(this.value=='')this.value=this.defaultV alue" It works swell! |
#5
| |||
| |||
|
|
Murray *TMM* wrote: Hey - use this: input type="text" name="n" value="Your message" onFocus="if(this.value==this.defaultValue)this.val ue=''" onBlur="if(this.value=='')this.value=this.defaultV alue" It works swell! Thank you Murray, it works very nicely! Steve |
#6
| |||
| |||
|
|
Yeah - I like it because it puts the default back when you click away if the field has not been changed. That is the ideal way for it to work, and I am glad you posted it |
#7
| |||
| |||
|
|
That is the ideal way for it to work, and I am glad you posted it becuase that reason alone made me not use the one that I found. |
![]() |
| Thread Tools | |
| Display Modes | |
| |