This may sound confusing but here it goes. I have a small search on my site, within this little search box i have some content, i.e. "search here!" . When you use this you have to first delete "Search Here!" And then input what you want to search for. I want it so when you click the box all of the content instantley disappears. make sense? Anyone know how to do this?
If you dont mind using javascript this will work. This is directly from one of my sites, so you can just change the class, name and other fields as you need. Make sure the onFocus and onBlur values matche the actual value in the form tag. Let me know if you need help. <input class="sp2_field" type="text" onfocus="if ( this.value == ' Search The Website ' ) this.value = '';" onblur="if ( this.value == '' ) this.value = ' Search The Website ';" id="q" maxlength="255" name="q" value=" Search The Website " /> Code (markup):
I believe that I understand what you mean. The technology you need is javascript. The code will be something like: <input type='text' name='search' onFocus='document.this_form.search = "";' /> Code (markup): The emphasis is on the 'something like', whenever I need to produce javascript code I need to consult a reference book and I don't have it to hand at the moment.
I was actually going to post the code used in the login box for this forum <input type="text" class="bginput" style="font-size: 11px" name="vb_login_username" id="navbar_username" size="10" accesskey="u" tabindex="101" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';" /> Code (markup): But actually the code posted by jestep would be my preference. The onblur is a really nice feature.
<input type="text" size="62" onfocus="if ( this.value == 'Hi' ) this.value = '';" onblur="if ( this.value == '' ) this.value = 'Hi';" id="q" name="q" maxlength="255" value="Hi" style="color: #CC0000" /> Code (markup): You dont need the id= field or maxlength or anything unless you want them.