Click to See Complete Forum and Search --> : text form??


Justin
06-03-2003, 01:16 PM
the value of a text box is ANSWER HERE

i want it so when you click on the box to write it will clear the current value so the visiter doesn't have to deleate it and so i can make shure that there is no spaces, what i am trying to do it is sencitve to spaces, i am asking questions and checking the answers.

AdamGundry
06-03-2003, 01:28 PM
1. <input type="text" value="ANSWER HERE" onclick="if (this.value == 'ANSWER HERE') this.value = '';">

2. str = str.replace(/ /g, '');

Adam

Gollum
06-03-2003, 01:29 PM
try this...

<input type=text onfocus="this.value = '';" onblur="this.value = this.value.replace(/\s/,'');">

the onfocus handler clears the text box
the onblur handler (opposite of focus) removes any spaces