nsForum logo

Welcome Guest ( Log In )

 
Reply to this topicStart new topic
> How To Add Default Text To Search Box
Rating 3 V
yoogimonster
post Feb 16 2009, 09:48 AM
Post #1





Group: Verified NS Member
Posts: 115
Joined: 11-February 08
Member No.: 644



Does anyone know how to add default text such as "Enter part number or keyword" to the site search box?

Thanks!
Go to the top of the page
 
+Quote Post
bendur
post Feb 16 2009, 09:58 AM
Post #2





Group: Verified NS Member
Posts: 100
Joined: 5-October 08
Member No.: 2,669



QUOTE (yoogimonster @ Feb 16 2009, 09:58 AM) *
Does anyone know how to add default text such as "Enter part number or keyword" to the site search box?

Thanks!


CODE
<script type="text/javascript">
    var el = document.getElementById("ctl00_ctl07_search");
    el.value = "Search Here";
</script>


Where ctl00_ctl07_search is the id of your search box, and Search Here is the text you want to show up there.
Go to the top of the page
 
+Quote Post
yoogimonster
post Feb 16 2009, 11:34 AM
Post #3





Group: Verified NS Member
Posts: 115
Joined: 11-February 08
Member No.: 644



QUOTE (bendur @ Feb 16 2009, 07:08 AM) *
CODE
<script type="text/javascript">
    var el = document.getElementById("ctl00_ctl07_search");
    el.value = "Search Here";
</script>


Where ctl00_ctl07_search is the id of your search box, and Search Here is the text you want to show up there.


Thanks for your quick reply! I guess there's no way to have the text disappear on mouseclick like most websites? It's a pain to have to delete the text before typing in your search term.

Also, do I just stick the code in my footer?
Go to the top of the page
 
+Quote Post
BoatersOutlet
post Feb 16 2009, 11:35 AM
Post #4





Group: Verified NS Member
Posts: 32
Joined: 20-August 08
Member No.: 2,049



And another question, is there a way to make the text automatically disappear when you click in the box?
Go to the top of the page
 
+Quote Post
bendur
post Feb 16 2009, 02:28 PM
Post #5





Group: Verified NS Member
Posts: 100
Joined: 5-October 08
Member No.: 2,669



Y'all are needy aren't you? (IMG:http://forums.networksolutions.com/style_emoticons/default/wink.gif)

CODE
<script type="text/javascript">
    var el = document.getElementById("ctl00_ctl07_search");
        var helpText = "Search Here";
    el.value = helpText;
    el.onfocus = function() {if (this.value == helpText) { el.value = "";}};
    el.onblur = function() {if (this.value == "") { el.value = helpText;}}
</script>


Where ctl00_ctl07_search is the id of your search input box, and Search Here is the text you want to automatically appear.

Oh, and your footer should work just fine. Be sure to turn off your wysiwyg editor before pasting the code in!
Go to the top of the page
 
+Quote Post
BoatersOutlet
post Feb 16 2009, 02:50 PM
Post #6





Group: Verified NS Member
Posts: 32
Joined: 20-August 08
Member No.: 2,049



HaHa, we must have been typing at the same time I guess. (IMG:http://forums.networksolutions.com/style_emoticons/default/embarassed.gif) Thanks for the script. Worked perfectly.
Go to the top of the page
 
+Quote Post
yoogimonster
post Feb 16 2009, 03:54 PM
Post #7





Group: Verified NS Member
Posts: 115
Joined: 11-February 08
Member No.: 644



QUOTE (BoatersOutlet @ Feb 16 2009, 12:00 PM) *
HaHa, we must have been typing at the same time I guess. (IMG:http://forums.networksolutions.com/style_emoticons/default/embarassed.gif) Thanks for the script. Worked perfectly.


Bendur you are awesome. Thanks so much!
Go to the top of the page
 
+Quote Post
superlamb
post Feb 27 2009, 09:40 AM
Post #8





Group: Verified NS Member
Posts: 10
Joined: 20-August 08
Member No.: 2,055



How can I use the code to populate both the email address field and product search? I've tried it several ways and the text in only 1 field will disappear, while the other stays there.
Go to the top of the page
 
+Quote Post
ArcoJedi
post Feb 27 2009, 12:01 PM
Post #9


Jedi Master


Group: Verified NS Member
Posts: 1,142
Joined: 10-August 07
From: Galaxy Far, Far Away...
Member No.: 13



You'd most likely have to paste the code twice, once with ctl00_ctl07_search and once with whatever your email field is. I'll admit I'm not sure on this one, but you can probably try it and see.
Go to the top of the page
 
+Quote Post
Thor
post May 1 2009, 12:08 AM
Post #10





Group: Verified NS Member
Posts: 54
Joined: 18-August 08
Member No.: 2,013



Great thread, should be sticky.
Go to the top of the page
 
+Quote Post
ddavisNS
post May 1 2009, 12:09 AM
Post #11


QA


Group: Administrators
Posts: 1,751
Joined: 10-August 07
Member No.: 6



thread pinned
Go to the top of the page
 
+Quote Post
sossupply
post Aug 21 2009, 09:55 AM
Post #12





Group: Verified NS Member
Posts: 42
Joined: 5-September 08
From: Dallas, Texas
Member No.: 2,298



Can I get some help with this, I followed all the instructions but its still not working. Please see code below.

<ns:search customtext="Search" type="custom" />


<script type="text/javascript">
var el = document.getElementById("ctl00_ctl03_ct100_search");
var helpText = "Product Search";
el.value = helpText;
el.onfocus = function() {if (this.value == helpText) { el.value = "";}};
el.onblur = function() {if (this.value == "") { el.value = helpText;}}
</script>
Go to the top of the page
 
+Quote Post
agkits
post Aug 21 2009, 02:54 PM
Post #13





Group: Verified NS Member
Posts: 666
Joined: 26-October 07
From: Syracuse NY
Member No.: 193



SOS which site are you trying this on? Depending on which site and where (left or right column) the search is, it will change the actual ID. So I just wanted to make sure first that you were the correct ID.
Go to the top of the page
 
+Quote Post
sossupply
post Aug 25 2009, 09:19 AM
Post #14





Group: Verified NS Member
Posts: 42
Joined: 5-September 08
From: Dallas, Texas
Member No.: 2,298



Sorry its www.soslightbulbs.com

I used firebug to get the column ID, I had this working previously and it just stopped!!!



QUOTE (agkits @ Aug 21 2009, 02:54 PM) *
SOS which site are you trying this on? Depending on which site and where (left or right column) the search is, it will change the actual ID. So I just wanted to make sure first that you were the correct ID.
Go to the top of the page
 
+Quote Post
christianbooksbi...
post Aug 25 2009, 10:10 AM
Post #15





Group: Verified NS Member
Posts: 829
Joined: 15-January 08
From: Chicago, IL
Member No.: 501



Great Thread.

To change the style of the text...what would the code be (i.e. to make it italic)?
Go to the top of the page
 
+Quote Post
EKop
post Sep 7 2009, 07:54 AM
Post #16





Group: Verified NS Member
Posts: 10
Joined: 1-August 09
Member No.: 4,877



Having difficulty getting this to work. Right now have just an empty box with a go button - which is how I wanted it to look, only would like the customer to know what to do with the empty box! (IMG:http://forums.networksolutions.com/style_emoticons/default/smile.gif)

note: I did not build left nav. using modules. I used one column of custom html and insterted ns: code.

code I used for search function: <ns:search type="default" />

Not sure why the java script won't work for "search here"


TIA!
Go to the top of the page
 
+Quote Post
lynn44
post Sep 7 2009, 02:23 PM
Post #17





Group: Verified NS Member
Posts: 204
Joined: 24-October 08
From: Pittsburgh, PA
Member No.: 2,842



QUOTE (EKop @ Sep 7 2009, 08:54 AM) *
Having difficulty getting this to work. Right now have just an empty box with a go button - which is how I wanted it to look, only would like the customer to know what to do with the empty box! (IMG:http://forums.networksolutions.com/style_emoticons/default/smile.gif)

note: I did not build left nav. using modules. I used one column of custom html and insterted ns: code.

code I used for search function: <ns:search type="default" />

Not sure why the java script won't work for "search here"


TIA!


Design/Site Design/Columns/Left side columns, Search Site-click the pencil to edit, the Module Name is Search SIte,
which can be edited, and in the text/html box at Header Text you can add text there. Hope this helps.
Go to the top of the page
 
+Quote Post
EKop
post Sep 7 2009, 04:03 PM
Post #18





Group: Verified NS Member
Posts: 10
Joined: 1-August 09
Member No.: 4,877



QUOTE (lynn44 @ Sep 7 2009, 02:23 PM) *
Design/Site Design/Columns/Left side columns, Search Site-click the pencil to edit, the Module Name is Search SIte,
which can be edited, and in the text/html box at Header Text you can add text there. Hope this helps.


Yes, I understand how to edit this area I built the html that goes in there, I couldn't figure out why this code would not work for my site. Seems it's part of the CSS that we do not have access to.
Thanks for trying to help!
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
Tags
No Tag inserted yet

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

RSS Lo-Fi Version    Network Solutions © 2009 Time is now: 21st November 2009 - 08:49 PM
Domain Names | Web Hosting | Web Design | Shopping Cart Software | Online Marketing | SSL Certificates