![]() |
![]() |
![]() |
||||
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. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
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?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Mar 2002
Location: c9media.com
Posts: 3,240
|
javascript onfocus event search for that
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
(felis madjewicus)
Industry Role:
Join Date: Jul 2006
Location: In Mom & Dad's Basement
Posts: 20,368
|
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.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
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...'" |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
|
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".
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 |
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;" /> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 | |
Confirmed User
Industry Role:
Join Date: Aug 2003
Location: Canada
Posts: 2,310
|
Quote:
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. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Registered User
Join Date: Nov 2008
Posts: 15
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
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. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
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...
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Confirmed User
Join Date: Nov 2005
Location: Secretely plotting a hostile takeover
Posts: 5,816
|
Some of us are, just depends who's around when the question gets posted I guess.
__________________
. . . . I have a sig
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
|
Developers come from a different stock ;)
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com |
![]() |
![]() ![]() ![]() ![]() ![]() |