![]() |
Search Box with Initial Value |
Post Reply
|
| Author | |
loracady
Newbie
Joined: 28-December-2007 Location: United States Status: Offline Points: 2 |
Post Options
Thanks(0)
Quote Reply
Topic: Search Box with Initial ValuePosted: 01-December-2009 at 11:44am |
|
I want to have a small search box that has "search keyword or item #" as the initial value. When a user clicks inside the search box, the initial value is automatically removed and the user can enter a keyword search term or item #. Has anyone done this?
|
|
|
www.TheSleepShop.com
|
|
![]() |
|
Greg Dinger
Certified ProductCart Developers
Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
Post Options
Thanks(0)
Quote Reply
Posted: 01-December-2009 at 11:54am |
|
Lora - do a view source on http://www.madcowcutlery.com/ have a look at the search box. tehre is a tiny bit of JS in there.
|
|
![]() |
|
netprofits
Certified ProductCart Developers
Joined: 05-January-2006 Location: United States Status: Offline Points: 22 |
Post Options
Thanks(0)
Quote Reply
Posted: 01-December-2009 at 11:56am |
|
Hi loracady, yes, we've done that for several of our clients' sites. See http://www.orchestratedhome.com/shop/pc/home.asp as an example.
Use something like this for the INPUT field:
<input type="Text" name="keyword" size="18" value="Search..." onfocus="if(this.value=='Search...')this.value='';" >
value="" should have the initial value you want displayed.
The onfocus section says that when a visitor clicks on the box, if the value = "Search..." then clear the value. You will need to change the this.value=='Search...' to match the initial value you enter in the value parameter.
Does that help?
|
|
![]() |
|
katharina
Senior Member
Joined: 25-October-2005 Location: United States Status: Offline Points: 0 |
Post Options
Thanks(0)
Quote Reply
Posted: 01-December-2009 at 11:57am |
|
This works with 3.51.
You need to add this to the header.asp or footer.asp depending on where you want it to show. <!-- Start Search Box --> <!-- #Include file="SmallSearchBox.asp"--> <!-- End Search Box --> Next you open SmallSearchBox.asp in the pc folder and edit it a tiny bit. Find the line: <input type="Text" name="keyword" size="23" value="" id="smallsearchbox" > and replace with: <input type="Text" name="keyword" size="23" value="Keyword or Item#" id="smallsearchbox" > You see I added the Keyword or Item#, but you can change that part to what ever you want. Do not loose the quotes on either end. This is just html editing, so no programing needed. You can see the result at www.germanplaza.com |
|
|
Katharina
******************* www.GermanPlaza.com ******************* |
|
![]() |
|
loracady
Newbie
Joined: 28-December-2007 Location: United States Status: Offline Points: 2 |
Post Options
Thanks(0)
Quote Reply
Posted: 01-December-2009 at 12:08pm |
|
Thanks, guys! You are a bunch of smarties!
|
|
|
www.TheSleepShop.com
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |