Go Back   Tech Support Forum > Design Forum > Web Design & Development

Join Tech Support Forum Today

Reply
 
Thread Tools Search this Thread
 
Old 10-20-2009, 10:30 AM   #1
Registered Member
 
Join Date: Oct 2009
Posts: 2
OS: win98 sp2


Hide Text onClick

Hello everyone, the new guy here. Thought I would see if you all could help.
I am trying to add an onClick event to hide the default text value of my text field. Here is my code without an onClick.

<form method='post' action='{SITE_ROOT}index.php' style='margin:0px'>
<input class="ibox_search" type='text' name='search' value='Search All' style='width:300'>&nbsp;<input class="ibox_search_submit" type='submit' value='{WORD_SEARCH}'>
</form>

Any help would be appreciated.

Thanks

__________________
oysterking is offline   Reply With Quote
Old 10-20-2009, 12:15 PM   #2
Design Team
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 2,181
OS: Win7, Ubuntu.


Re: Hide Text onClick

Oh right, just to clarify you want it to hide "Search All" when the input box is clicked? If i'm right in assuming that:

Code:
<input class="ibox_search" type='text' name='search' value='Search All' style='width:300' onfocus="this.value=='Search All'?this.value='':this.value=this.value;" onblur="this.value==''?this.value='Search All':this.value=this.value;">
It makes sence to use onfocus rather than onclick because a user can tab to the input box aswell... And the onblur code simply checks to see if the text box is empty and replaces that with "Search All" if it is.

Cheers,
Jamey

p.s. Welcome to tsf =]

__________________
jamiemac2005 is offline   Reply With Quote
Old 10-20-2009, 01:36 PM   #3
Registered Member
 
Join Date: Oct 2009
Posts: 2
OS: win98 sp2


Re: Hide Text onClick

Yes that was a correct assumption, works perfect.
Thanks Jamey, your the bomb !!!
__________________
oysterking is offline   Reply With Quote
Old 10-20-2009, 01:58 PM   #4
Design Team
 
jamiemac2005's Avatar
 
Join Date: Jul 2007
Location: Coventry, UK
Posts: 2,181
OS: Win7, Ubuntu.


Re: Hide Text onClick

That's cool, glad i got it right =]

Cheers,
Jamey
__________________
jamiemac2005 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is on
Smilies are on
[IMG] code is on
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Post a Question





Our Communities

Our communities encompass many different hobbies and interests, but each one is built on friendly, intelligent membership.

» More about our Communities

Automotive Communities

Our Automotive communities encompass many different makes and models. From U.S. domestics to European Saloons.

» More about our Automotive Communities

RV & Travel Trailer Communities

Our RV & Travel Trailer sites encompasses virtually all types of Recreational Vehicles, from brand-specific to general RV communities.

» More about our RV Communities

Marine Communities

Our Marine websites focus on Cruising and Sailing Vessels, including forums and the largest cruising Wiki project on the web today.

» More about our Marine Communities


All times are GMT -7. The time now is 01:19 AM.


Copyright 2001 - 2010, Tech Support Forum

Windows 7 - Windows XP - Windows Vista - Trojan Removal - Spyware Removal - Virus Removal - Networking - Security