Default Search Text |
Post Reply |
Author | ||
knifepro
Newbie Joined: 18-February-2008 Location: United States Status: Offline Points: 9 |
Post Options
Thanks(0)
Posted: 03-January-2013 at 11:35am |
|
Can someone tell me how to add default text to the small search box, make it disappear on click and blur?
Something like.... Search here... Search by Sku or name... Any help would be appreciated.
|
||
Brian
brian@theknifeprofessional.com brian@heartlandbraidedrugs.com www.theknifeprofessional.com www.heartlandbraidedrugs.com ProductCart v4.7 QuickBooks Sync Mobile |
||
Greg Dinger
Certified ProductCart Developers Joined: 23-September-2006 Location: United States Status: Offline Points: 238 |
Post Options
Thanks(0)
|
|
Hi Brian - go view the source on http://www.shopatdean.com/
You will see code associated with the search form. If you need it physically pulled apart and presented as a solution, I can do that later but I wanted to give you a quick tap in the right direction.
|
||
knifepro
Newbie Joined: 18-February-2008 Location: United States Status: Offline Points: 9 |
Post Options
Thanks(0)
|
|
Greg,
Thanks for the quick reply. I think I found a solution. So far it is working. Here is what I did just in case anyone else is looking: Somewhere around line 14 in smallsearchbox file you will find: <input type="Text" name="keyword" size="14" value="" id="smallsearchbox" > Replace with: <input type="Text" name="keyword" size="14" value="Text to be displayed here" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" id="smallsearchbox" >
|
||
Brian
brian@theknifeprofessional.com brian@heartlandbraidedrugs.com www.theknifeprofessional.com www.heartlandbraidedrugs.com ProductCart v4.7 QuickBooks Sync Mobile |
||
Guests
Guest |
Post Options
Thanks(0)
|
|
Hi Brian,
I like the use of the .defaultValue property. It's a bit more elegant that the more literal arguments I've always used. One other thing I like to do here, though, is to preserve the search phrase entered as a session variable so if the user does a search and then navigates around a bit, they can easily get back to their last search. Here's the bit of server-side code for that:
Place that in the ASP section of code right above the search form. Then you'd modify the value property of the input field like so:
|
||
nepcosignsupply
Newbie Joined: 13-April-2011 Status: Offline Points: 0 |
Post Options
Thanks(0)
|
|
I don't know if anybody is still watching this, but I tried putting in that code to replace the previous line located around line 14 in smallsearchbox and nothing happened for me. I also tried just changing the value="" to something different and I got nothing. Any suggestions?
|
||
Guests
Guest |
Post Options
Thanks(0)
|
|
Have a look at Brian's KnifePro site. You can see it at work there. Compare your script with his and you should be able to dial it in.
|
||
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 |