Is it possible to have text in the input box of a form, and when the user click in the text box, the text disapear and he can type whatever in need to write ?
Uhh, I think this should do the trick: HEAD section: <script language="Javascript"> <!-- function doClear(theText) { if (theText.value == theText.defaultValue) { theText.value = "" } } //--> </script> Code (markup): BODY section: <form> <input type="text" size=15 value="Value here" onFocus="doClear(this)"> </form> Code (markup):
You don't even need the javascript to control it, use this inside your <form> tags: <input type="text" name="Search" size="25" value="Default Text" onfocus= "if (this.value=='Default Text') this.value='';" onblur="if (this.value=='') this.value='Default Text';"> Code (markup): I know it works - I use the same piece of code on all my sites
Epp, yeah thanks. I just made the function so you don't have to write over and over again assuming you have lots of text boxes/areas on your page. Thanks for the rep.