Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-25-2010, 02:33 PM   #1
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
How do you make this kind of search box? [HTML/CSS]

How do you make a search box that says "Search..." and when you click on it, it removes the search text so you can enter in your desired text. When you click off of it it displays "Search..." agian. How is this done in html, css, or js, etc?
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 02:35 PM   #2
sexyclicks
Confirmed User
 
sexyclicks's Avatar
 
Industry Role:
Join Date: Mar 2002
Location: c9media.com
Posts: 3,240
javascript onfocus event search for that
sexyclicks is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 02:40 PM   #3
Angry Jew Cat - Banned for Life
(felis madjewicus)
 
Industry Role:
Join Date: Jul 2006
Location: In Mom & Dad's Basement
Posts: 20,368
Quote:
Originally Posted by eMonk View Post
How do you make a search box that says "Search..." and when you click on it, it removes the search text so you can enter in your desired text. When you click off of it it displays "Search..." agian. How is this done in html, css, or js, etc?
Curious myself. I got that on my blogs that allow search, and as far as usability goes, it's a pain for the user. One of those small peeves that I find irritating yet haven't fixed yet either, lol.
Angry Jew Cat - Banned for Life is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 02:48 PM   #4
JD
Too lazy to set a custom title
 
Industry Role:
Join Date: Sep 2003
Posts: 22,651
add this to the input html
onfocus="this.value=''"
onblur="this.value='Search...'"
JD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 02:53 PM   #5
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
Quote:
Originally Posted by JD View Post
add this to the input html
onfocus="this.value=''"
onblur="this.value='Search...'"
That works but it doesn't show "Search..." on load + when you click off with your desired text string it gets replaced with "Search...". Also when no search string is entered and you hit the enter key it will search for "Search".
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 02:53 PM   #6
mattodue
Registered User
 
Join Date: Nov 2008
Posts: 15
Code:
<input type="text" name="search" value="Search..." onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" />
mattodue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 03:02 PM   #7
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
Quote:
Originally Posted by mattodue View Post
Code:
<input type="text" name="search" value="Search..." onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" />
That worked.

I'm using a php script and the default value was:

value="{$g_term}"

replacing it with value="Search..." ok? I'm trying to figure out what that $var is for and if I can replace it safely.
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 03:06 PM   #8
mattodue
Registered User
 
Join Date: Nov 2008
Posts: 15
Quote:
Originally Posted by eMonk View Post
That worked.

I'm using a php script and the default value was:

value="{$g_term}"
{$g_term} is probably used for the term that a user is searching for. So, someone searching for "keyword" will automatically put that term in the box.
mattodue is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 03:09 PM   #9
eMonk
Confirmed User
 
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
Thanks mattodue.

The search box seems to be working fine without that $g_term variable.
eMonk is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 03:55 PM   #10
Argos88
So Fucking Banned
 
Industry Role:
Join Date: Sep 2009
Posts: 1,732
I wish people were so willing to help when someone asks a business question...
Argos88 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 03:58 PM   #11
EdgeXXX
Confirmed User
 
EdgeXXX's Avatar
 
Join Date: Nov 2005
Location: Secretely plotting a hostile takeover
Posts: 5,816
Quote:
Originally Posted by Argos88 View Post
I wish people were so willing to help when someone asks a business question...
Some of us are, just depends who's around when the question gets posted I guess.
__________________
.
.
.
.

I have a sig
EdgeXXX is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-25-2010, 03:58 PM   #12
BestXXXPorn
Confirmed User
 
BestXXXPorn's Avatar
 
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
Quote:
Originally Posted by Argos88 View Post
I wish people were so willing to help when someone asks a business question...
Developers come from a different stock ;)
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com
BestXXXPorn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.