Lemon Squash
02-12-2003, 04:03 PM
Okay ive got this little email form thinggy and it has stuff type in like name: put your name here but i want it so when you click your mouse in it, it goes all blank.. hows it done? :)
|
View Full Version : Email form input thinggy.. removing the text when you click in the box Lemon Squash 02-12-2003, 04:03 PM Okay ive got this little email form thinggy and it has stuff type in like name: put your name here but i want it so when you click your mouse in it, it goes all blank.. hows it done? :) starlet 02-12-2003, 05:02 PM in the head tag <script language="Javascript"> <!-- function doClear(theText) { if (theText.value == theText.defaultValue) { theText.value = "" } } //--> </script> on the form feilds you want it to happen on onFocus="doClear(this)" Eg <input type="text" size="15" name="url" value="http://" onFocus="doClear(this)"> Lemon Squash 02-12-2003, 05:21 PM Hey great it works thanks!! :D ThaLoCa 02-12-2003, 06:04 PM I think this one is cooler....It has text in it....but when you click on it (tot write text) the text goes away, and when you don't write something, and move to another thing, the text comes back! here's the code: onFocus="if (this.value == 'your value') this.value = '';" onBlur="if (this.value == '') this.value = 'your value again';" eg: <input name="name" maxlength="20" onFocus="if (this.value == '.:Name') this.value = '';" onBlur="if (this.value == '') this.value = '.:Name';"> Good Luck! |