Industry guru Dave Taylor offers tech support on technical and business topics, including iPhone, iPod, Microsoft Windows, Sony PSP, cellphones, online advertising, CSS, Web design, business, Unix, Linux, SEO, Mac OS X, and shell script programming.     


How can I add a Google search box to my Web site?

Dave, I keep visiting sites and seeing these cool search boxes that let you either search their entire site or search the entire Google database, all without leaving that page! I want to have something like this and would appreciate your helping me figure out the code needed.

Dave's Answer:

This is a question that's going to result in some HTML listings. You know that, so there's no reason to panic!

First off, the good news. Google itself actually has a nice page offering you HTML code you can just cut and paste onto your own Web pages to produce the search box you seek, and some variants beside. Just check out Google Free.

Instead of relying on the bright sparks at Google, though, let's go through the steps of building our own search box instead, so you'll be able to see how it works.

Also, not to pick on Google because I think the world of those folk, but their HTML samples could be cleaned up a bit, usually, so I've also recast it as proper XHTML rather than somewhat sloppy HTML. Just don't tell Larry and Sergey, okay?

The basic technique involved here is to be able to manipulate one of the variables handed to the Google search engine, a variable called sitesearch. Set it to a null value and you're searching the entire World Wide Web, but set it to a specific domain and it's constrained exactly as if you had typed in the Google special notation site:domain.

In addition to that, you need an input field and a submit button. Put them all together and here's the minimalist Google search form that lets the user alternate between just your site (well, in this case just my site) or the entire Web:

<form method="get" action="http://www.google.com/search">

<input type="text"   name="q" size="31"
 maxlength="255" value="" />
<input type="submit" value="Google Search" />
<input type="radio"  name="sitesearch" value="" />
 The Web
<input type="radio"  name="sitesearch"
 value="askdavetaylor.com" checked /> Ask Dave Taylor<br />

</form>
There are some additional tweaks we can apply to make it a bit more fancy, including changing the radio buttons to a single check box, and aligning things a bit more nicely using a table and some simple CSS:
<form method="get" action="http://www.google.com/search">

<div style="border:1px solid black;padding:4px;width:20em;">
<table border="0" cellpadding="0">
<tr><td>
<input type="text"   name="q" size="25"
 maxlength="255" value="" />
<input type="submit" value="Google Search" /></td></tr>
<tr><td align="center" style="font-size:75%">
<input type="checkbox"  name="sitesearch"
 value="askdavetaylor.com" checked /> only search Ask Dave Taylor<br />
</td></tr></table>
</div>

</form>
Here's how that renders when included on an HTML page:

only search Ask Dave Taylor
If you'd like to use this on your own site, simply change the occurrences of askdavetaylor.com as appropriate.

Not too hard at all!


Related HTML, JavaScript and Web Site Programming articles:
✔   How to Create Predefined Google Image Search Links?
Thanks for the Amazon URL [see Creating Amazon Search Links]. That worked beautifully. In fact, I sent you $5.00 for coffee in thanks....
✔   Can I embed a Facebook search box on my blog site?
I've seen your articles about how to add a Twitter or Google search box on a Web page, but I have a tougher...
✔   Can I use CSS for drop shadows on my blog?
I want to give my site a bit of a facelift and add some neat graphical elements. One of which is drop shadows....
✔   How can I embed interactive photo panoramas on my site/blog?
I read through your blog entry about how to take panoramic photos with iOS 6 and an iPhone 5 and got enthused. I've...
✔   How can I create a Twitter search URL shortcut?
I'd like to add a few Twitter search links to my Web site. Is that possible, or does Twitter prohibit this sort of...

Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
    Enter your name: and your email addr:  









Reader Comments To Date: 817

PJ said, on December 10, 2004 10:12 PM:

I tried this and when I try to enter a search term it sends me to the google page. Any thoughts on what I may be doing wrong or not doing.
Thanks

Dave Taylor said, on December 11, 2004 4:23 AM:

If it's working properly, the search box should send you to the Google site, but with the word or words you typed in prefilled in as the search terms. Is this not what you're seeing? If so, what are you seeing? Also, what happens when you type in a term on the search box at the end of my article? Does that work for you?

John Kiester said, on December 11, 2004 4:51 PM:

Is there a way to have the results pop-up in a new window?

Dave Taylor said, on December 11, 2004 5:07 PM:

John, you'll laugh when you find out how easy that is! The line

<form method="get" action="http://www.google.com/search">

just needs to have target="new" added and it'll redirect the result of that form to a new window called "new". If you always want to guarantee that a new window is launched rather than possibly reusing the 'new' window, use "_blank" as the target instead:

<form method="get" action="http://www.google.com/search" target="_blank">

Hope that helps!

PJ said, on December 11, 2004 5:10 PM:

I looked at my coding several times last night and missed a typo. Things are working just fine now. Thanks for your help.

David said, on December 13, 2004 1:39 AM:

OK...I must be missing something here. How does this code search MY site? For example, if I have the word "pumpkin" on a page in my site will this search return a URL to that page?

Dave Taylor said, on December 13, 2004 1:51 AM:

Thanks for your note, David. Checking on "search my site" in the form causes the search to automatically include "site:yourdomain" so that it only searches pages in the Google database that have your domain as the base of the URL. In essence, it's a search engine for your site alone. Matches then go back to your site. Hope that clears things up!

David said, on December 13, 2004 10:31 PM:

Dave, now I understand what it is supposed to do. I thought it was going to search in MY domain...within my site...for the text entered...my bad. Thanks for setting me straight. David.

adam said, on January 20, 2005 8:49 AM:

I would like a search box to find things within my site only. my site is not ready yet to submit to any of the search engines as i dont want to get black listed for broken links etc. How can I make and test a search box for my site without submitting to Google etc.

Cheers

Dave Taylor said, on January 21, 2005 2:41 PM:

You can't use the Google search tool to find content on your site if you don't want Google to see it, Adam, so you'll need to install a search engine of your own on your server. If that's a possibility, then I'd talk with your Web hosting provider because they might already have something installed. Good luck!

Donna said, on June 3, 2005 4:14 AM:

Thank you for this tip! How kind of you to do all this work so I can have it so easy. THANK YOU THANK YOU THANK YOU!

Piyush said, on June 26, 2005 4:26 AM:

I'm making my site and have kept the google search in it. It's too easy to put google search and in few seconds it worked fine.

Thanks alot for the code that is mentioned here.

I've added my site to google and would like to know more about how I can get my site on the index page of google.

Regards,
Piyush

Vikesh Jain said, on July 29, 2005 12:15 PM:

Dave,I have added Google to my webpage using the "Google free" code. Can you please tell me how can i by default place the cursor in google search box?

Tracy said, on August 5, 2005 8:51 PM:

It is my understanding that you can get paid by Google when people use your site's Google search box. How does that work? Do the ads have to be able to pop up on your site or can the inquiries be sent to the Google website, leaving our website free of clutter? How do you set it up so that we get paid when people use our search box? I have tried to find the answer in Google's help pages but I just can't seem to get a solid answer anywhere.

We are also trying to customize the appearance of our Google search box so that it fits within a certain space designated on our website. Any recommendations?

I am at my wits end and desperate for help!

Nadine said, on August 18, 2005 11:07 PM:

I'm trying to add the Google search to my blog, but it doesn't seem to work. Perhaps I'm inserting it in the wrong location. Perhaps I need different code because it's a blog, not a web site. Any help would be appreciated. The blog's purpose is to facilitate communication among former high school classmates, many of whom do not seem to be very Internet savvy. I'm hoping a "search this site" function will help them to locate names more easily

manny said, on August 19, 2005 8:45 AM:

how can i make a search "form" such as one that a car dealer would use to have people search his site for a car. one that would use multiple boxes such as "make", "model", "color" etc. and use all the boxes to come up with results

Jillian said, on August 27, 2005 5:58 AM:

Hi Dave, I entered the code like said and changed the domain, but the search won't work on my site. (as in, won't return a search relevant to my site), but will do the google search just fine (when i uncheck the box). any thoughts on how i can fix this? thanks!

Dave Taylor said, on August 27, 2005 6:37 AM:

Two issues, Jillian. First off, you need to not send the "http://" part in your 'sitesearch' field, but more importantly, a search of Google shows that it doesn't have a single page of your site in its search engine, so there's no way for it to ever succeed. Try searching for 'site:www.askdavetaylor.com', for example, then search for 'site;vespa-rosso.blogspot.com' and you'll see what I mean. Sorry!

Jillian said, on August 27, 2005 4:59 PM:

Dave, I'll fix the first part (the http), but I also noticed the google search thing. How can I change this? I listed my site with google about a week or two ago. Thanks!
Jillian

Dave Taylor said, on August 28, 2005 4:11 AM:

You might just need to have some patience, Jillian. Google has a "sandbox" where brand new sites and domains are parked for a few weeks up to a few months before they're added to the full Google database. That's so spam sites don't just pop up and corrupt / pollute the Google database, but it's darn frustrating for us legitimate content providers. Sorry!

Deborah Skipper said, on September 3, 2005 9:38 PM:

Hi Dave, I've read all your comments to other posts and I'm using CityMax for my host and they don't offer a search box for my site. I'd love to have one that just searches my site and no advertisements.. google seems to have a problem with my site since it's through a host and not mine... :(Can you help me with how to add a search box to my site that only returns items from my site with pictures? Like any one of the pages listed below would be fantastic.
www.silady.net (www.silady.net/page/page/2265521.htm(home page)), (www.silady.net/bracelets.html),
(www.silady.net/earrings.html), (www.silady.net/necklaces.html),
(www.silady.net/pendants.html), (www.silady.net/rings.html), (www.silady.net/sets.html), (www.silady.net/page/page/2319361.htm)

Thanks and praying really hard for help :) Deborah

chris said, on October 11, 2005 8:41 PM:

Hi Dave,

I ve got the google search on one of my sites and it works great for searhced throughout that site.
However I would like to have the search box search sites "a" "b" & "c" all at the same. So far i can only get it to either serach teh whole web or just the one site. Ive tried checking all teh radio buttons, but this just makes its search teh last one.

any ideas?

Balaji said, on October 12, 2005 11:57 AM:

i have a set of pages to be listed and another set which should not be listed.. how do i do this?

Dave Taylor said, on October 12, 2005 6:36 PM:

Balaji, you'll want to learn more about the robots.txt file, and specifically the equivalent meta tag you can add to specific pages that tell search engines not to include those pages in indices. See: http://www.askdavetaylor.com/about_robots.html

DJ Ortiz said, on October 16, 2005 5:57 PM:

Hi Dave, I was reading your article about the Google Search Box. I have a website running in PHP-Nuke. The code does not seem to work. I tried adding it to a block, and all that appears is just the *.gif from Google. Can you help?

Youx said, on November 2, 2005 2:01 AM:

Ok I see that you have ads by google on the top..well I signed up for google ad sense..and when I copied and pasted the html code to a site..the ad on there was for another site. Isn't it supposed to show my site ad? Could you help me out on how to advertize my site?

Dave Taylor said, on November 2, 2005 4:05 AM:

Youx, I don't really understand what your expectations of AdSense are: you don't want ads for your own site on AdSense, because then you'd be paying for click-thrus that are from people already at your site. Make sense?

Vidya said, on November 20, 2005 10:51 PM:

I got a search box coding from your site. Thanks a lot for it.
I am doing a search engine website. When i do this site i may get lots of problems, i think i can get solutions from your site.

Thanks a lot.

Danny said, on November 29, 2005 6:54 PM:

I was wondering if there is any way to add a 'Local' search box to my web site. I would like to have a link to search local restaurants, stores, etc... Is there any weay to do this?

Thanks!

cw said, on December 5, 2005 10:19 PM:

I was wondering if you can stop the google search from looking in certail folders/directories?
Also can you customize the look of the search page?

Thanks for all the help?

cw said, on December 6, 2005 2:32 PM:

Thank you for all you do for us.
Is there a way to stop the google search from searching certain directories on your website?

Dave Taylor said, on December 7, 2005 7:28 AM:

Yes, check out the robots.txt information on the Google site:

http://www.google.com/webmasters/bot.html

I think that'll show you how to exclude certain directories.

Sajja Rjaes said, on December 26, 2005 11:36 PM:

can i include in my site to search web sites from my site or i need to pay any thing? it is opening search result in the same web brouser cant we open in the new web brouser?

Dave Taylor said, on December 27, 2005 11:09 AM:

Sajja, you're welcome to use this code for free - thanks for asking - and if you want to have it open in a new browser, add

target="_blank"

to the "form" tag.

Peder said, on January 7, 2006 4:33 PM:

I put a google free site search on my webpage and there is another one below that with search the web and my website. I look in the HTML code but there isn't any for the bottom one. I only copied the HTML for the top one. How do I remove the bottom one?

Dave Taylor said, on January 8, 2006 12:02 PM:

Peder, assuming you haven't copied and pasted it twice, I can't imagine how the code I present here could produce two search boxes for you. Can you email me your page URL (use the "Ask" button near the top) and I'll have a quick peek?

John said, on January 19, 2006 10:37 AM:

How do I add in the option of searching either the Web or only pages from the UK

Dave Taylor said, on January 19, 2006 10:44 AM:

John, just tweak the code I show to have the option of adding site:uk as a way to constrain your search results.

John said, on January 19, 2006 1:03 PM:

thanks for the quick reply. Not knowing how to do HMTL code you couldnt give me a clue how to restrict the search.

John

Ian said, on January 20, 2006 3:29 PM:

Dear Dave,
I was wondering, could a form like this work when trying to search images and web on google as two seperate actions in one form.

george said, on January 24, 2006 3:51 PM:

is there any way to have the results of the search display in my own page rather than googles? if not, do you know of a search engine that can be bought that has functions to prioritize search results? let me add my thanks to the bunch. thanks.

george

Trudes said, on February 8, 2006 12:36 PM:

A couple of questions:
I know the first one has been asked a couple of times here but I haven't seen an answer yet. Can you get the google results to come up on your own page, instead of transferring to the google website?

And is there any way of tracking what people are searching for, when they use the search box on your site? Any ideas of how you can do this?

Dave Taylor said, on February 8, 2006 2:45 PM:

George, Trudes, no, you can't do that without some sneaky hacking behind the scenes that Google won't look upon happily. In terms of what they're searching for, yes, you could theoretically create a search box that feeds the search query to an intermediate script that logs their search pattern then bounces them directly to Google. Hmmm.... :-)

Trudes said, on February 9, 2006 5:26 PM:

Ok, now you've lost me. How would I set up an intermediate script? I'm still learning!

mohamed said, on February 11, 2006 5:01 AM:

how can i add vote button to my website.

Anjanette said, on February 17, 2006 5:34 PM:

When you use google as a search engine on your own site, I think you still need to display the Google graphic. (See Section 2.3 Attribution at http://www.google.com/services/terms_free.html ). Please correct me if I'm wrong.

Chris said, on March 2, 2006 8:23 AM:

I've been looking for some proper valid code for these pesky search boxes all day. At last I've found it! Thanks Dave! And (if it isn't too late) Happy New Year :)

James said, on March 12, 2006 9:16 PM:

Hello, recently I decided to add a search feature to a site I'm constructing, http://skee.zaiph.net
However, the Google search bar doesn't work! If I attempt to search for any keywords whatsoever while on the "Search this site" option, no results appear.
The site uses an iFrame, is there a chance that this may have effected the searches?
Also, when I was on the panel that enables me to control the search bar (I am using the free one that enables the site's banner to display on the results pages), it states only 1 page is registered for my site.
How can I add more of my site's pages to the Google database? Why isn't the search bar working?

Thanks in advance! Also, if this helps any, the link to the Google searchbar is at
http://skee.zaiph.net/other/googlesearchtest.html

~James

Dave Taylor said, on March 12, 2006 10:18 PM:

James, the reason that Google isn't finding your search results is because your site is just too new. Your best bet for getting into the Google database is simply to have sites point to you and make sure that each of your pages points to all your other pages. Then just have some patience!

Deepa said, on March 21, 2006 12:21 PM:

Hello Dave,
If you visit my page, you can see that I need major help with my page. First, I want my side bar to align right next to the posts. Second, the google search does not work with my site. I know that there are only 2 comments, but when I type "Dr. Hyde in the Wordpress search, it comes up with the comment that has Dr. Hyde in it, whereas the google search for my site does not..... PLEASE HELP.. i am not familiar with CSS, but if you canhelp, it would be great
Thank You
Deepa

Deepa said, on March 23, 2006 5:05 AM:

Dear Dave,
I posted my question a couple of days ago and I don't know when to expect a response from you. I don't know how these forums work either. I just wanted to let you know that I am in deperate need of help. Please, anyone, can you help me?

Steve said, on March 24, 2006 6:27 PM:

Excellent information!

I'm using the Google search (not for my site, just to do full web searches from my site). How can I get the cursor to default to the Google input box?

I'm glad to send you a link to my site, but didn't want to post it as it's under construction, and currently lacking in some areas of security.

Thanks for any help or suggestions!

-Steve

Cecilia said, on March 25, 2006 9:21 AM:

I would like to have the Google search box search several different sites (call them "a" "b" & "c") all at the same. So far I can only get it to either search the whole web or just one site. I can do this with Yahoo but can't figure out how to do it with the Google code.

any ideas?

Dave Taylor said, on March 27, 2006 8:54 AM:

Steve, that's a basic JavaScript trick: make sure that the input field has an explicit name (which it should anyway, let's call it "fieldname" for this explanation) and that the form itself has a name (add a name="formname" attribute within the FORM tag itself), then in the BODY tag add the following attribute:

onLoad="'document.formname.fieldname.focus();"

that should be all you need to do!

javier velasquez said, on April 1, 2006 8:51 PM:

Hi, How would be the same search box using froogle?
Thanks in advance

Castor said, on April 15, 2006 4:41 PM:

Your code and this page are not XHTML valid. I believe the checked value is the problem.

Rob said, on April 18, 2006 3:00 PM:

First, many thanks for the great information! Can you please explain how to use the site: variable to search several different sites at the same time? I would like to have a search box on my intranet that searches a handful of sites, but I don’t want to offer each site as a choice, I just want a box and the Google search button, and have it search all of the sites.

Thanks in advance for your help.

Mae said, on May 4, 2006 6:38 PM:

Dave, how can you change the attributes of the Submit button (font, color, color of the button, etc.)? When I get the answer, I promise to buy you that chai.

Dave Taylor said, on May 5, 2006 11:48 AM:
Fashion Victim said, on May 7, 2006 5:52 AM:

Thanks Dave! You're the best. It's hard for my readers to search my old blog postings but you've just made it easy and nice to look at!

Mukul said, on May 14, 2006 4:24 AM:

I would like to have the google search and google adsence to my website can you guide me how to do it.

If i copy-paste the the code you mention above where will the box be placed on my webpage , will it not change all the existing setting.

Dave Taylor said, on May 15, 2006 10:08 PM:

To get started with AdSense, Mukul, please check out the following quite popular reference page:

http://www.askdavetaylor.com/how_do_i_get_started_making_money_with_google_adsense.html

Hope that helps you out!

Jeff said, on May 20, 2006 8:46 AM:

Using the "google search" seems reltively easy as you explained! It seems the only search I get is from my index (home) page? What is the proper code to search all pages? I'm the novice here when it comes to html and my site is as "green" as can get for expertise! Thanks so much and I do enjoy all the reading! You're very knowledgable and appreciated!

Jeff

sangram said, on May 22, 2006 8:32 AM:

please give some idea to develop a searc engine.
Or give me some method how to implement google search so that my company logo will come after search,means i dont want to allow google logo

Vitali said, on June 14, 2006 8:16 AM:

Thanks a lot for the code, but I couldn't get it to search an internal database on an internal network (my code for database search was as value="K:\InternalDatabase\" (drive and file names changed for security reasons, yet the format is exactly how I have it)). Do you know if I can make the database searchable with Google Search?

Miriam said, on June 18, 2006 6:39 PM:

I would love a search box for my site however, I don't like the way it is boxed with a black line.
Is it possible not to have it outlined?

Dave Taylor said, on June 19, 2006 9:51 AM:

Miriam, that's easy. Just take out the

border:1px solid black;

from the code snippet (it's in the "div" tag) making sure not to remove the quote just before it, and you'll have the box and search function without the black box line!

Matt said, on June 28, 2006 10:48 AM:

I was wondering, I want to put this google bar in my banner on my page, but I am building it in Fireworks and there is no code view, can I do this? I also will be using either Dreamweaver or FrontPage, could I put it in my banner using one of these programs? I would use the banner as a background image except I have my buttons on it so I am going to have to import it as multiple Fireworks files. Help would be great! Thanks!

nick said, on July 6, 2006 9:59 AM:

I added the Google site search to my site last year. But it does not find new content.

For example, I added the terms "yankee doodle dandy" to a test page back on 9/9/2005. However, upon a "site" search, it does not locate the page with that term.

Can I assume that my site must be re-indexed by Google before any new content will be found?

thanks in advance

Bill Randle said, on July 14, 2006 2:08 PM:

I've trie to put google search on my site in the top border (front page) so it will appear on each page, but I cut and pasted it, couldn't find the html for the border. Help......Nice site!!!

Vish said, on July 17, 2006 1:53 AM:

hi dude....i ur site is very useful for me....here i come up eiyh one question...

i need to add my website in google search...
i looked some articles related to google search optimization...but iam clear ...so can u help ?

i need the simple steps in designing , implemetation & i also want to know about aother pay search engines...

it will be very help full for me if u do this
thanks
vish

Steve said, on August 8, 2006 10:55 AM:

Hi Dave - This should be easy for you, but I'll still buy you a Chai if you can help... I just put an Adsense search box on my front page, but I'd really like the button to default checked on MY site. What do I have to modify in the code? Thank you so much.

Steve said, on August 8, 2006 12:02 PM:

...And while I'm asking, I just noticed that on my OS X system, When I used the search box with "web" clicked, it turns up nothing in the search! But it's just fine on my older system. What am I doing wrong...? Thanks again.

Dave Taylor said, on August 8, 2006 3:34 PM:

Steve, the AdSense search box is a different beast. Let me dig around and see what I can put together.

nephi said, on August 22, 2006 2:58 AM:

I'm grateful for websites like this, and I'm very thankful for people like you, dave. Thank you very much. But I'm wondering if, for example, somebody did a search for my website and did not find it, but my other website can be found, how can I add the new website to appear in the search?

Jerry Mersch said, on September 1, 2006 5:34 PM:

Dave, I can't get either of your above sets of search code to work. What could I be doing wrong. Thanks , Jerry

Terri said, on September 15, 2006 7:03 AM:

I can't get Google Search box to work on my intranet site. Can it work on an intranet site?

Kartik said, on September 25, 2006 3:37 PM:

hello dave,actually i am kind of new to adsense and web designing.I have a blog at http://technogeekzz.blogspot.com/ at blogger.com.Now
I want to enter the google searchbar and some other banners on my site related to google software.I have the html codes(thanks to you for the google searchbar )but i dont know where to put this actually.There is an option in the templates section at blogger.com where i can view and edit the whole html code of my site but i dont know exactly where to put these banners and searchbars.Any help would be greatly appreciated.please reply here or if u can plz mail me at kartiksatija@gmail.com it would be really great...thanx in advance...awaitinf for ur reply

Jeroen Messely said, on September 29, 2006 7:41 AM:

I am truly amazed by this site! Why are you doing this? WHEN are you doing this? - Anyway, I very much like the 'additional tweaks' version of the script on top of this page. Can you also do it the other way round? I mean, what is the code to create a decent search box and submit button just to search your own site and a little check box underneath if you want to search all of Google?

Thanks.
Jeroen (pronounced as 'yaroon'), Belgium

Dave Taylor said, on September 29, 2006 10:21 AM:

You can most definitely tweak things. Have a look at how I integrated the AdSense for Search system into my Intuitive Life blog, actually:

http://www.intuitive.com/blog/

(it's on the right nav bar, about half-way down the page)

Then read this to see how it was done:

http://www.askdavetaylor.com/how_can_i_get_google_search_results_on_my_site.html

jason said, on October 4, 2006 2:09 AM:

lol hey dave

killer script

thanks

Jason
ZTEK

Yoki said, on October 7, 2006 10:54 AM:

I added your google search tags to my webpage, which didn't pass XHTML validation. To be sure, I pasted your tags on an empty page, but it still earned one error as below. Please help!

+++++++++++++
the name and VI delimiter can be omitted from an attribute specification only if SHORTTAG YES is specified.

value="askdavetaylor.com" checked /> only search Ask Dave Taylor

"VI delimiter" is a technical term for the equal sign. This error message means that the name of an attribute and the equal sign cannot be omitted when specifying an attribute. A common cause for this error message is the use of "Attribute Minimization" in document types where it is not allowed, in XHTML for instance.

How to fix: For attributes such as compact, checked or selected, do not write e.g <option selected ... but rather <option selected="selected" ...

Dave Taylor said, on October 7, 2006 12:46 PM:

Easily fixed to be fully XHTML compliant:

value="askdavetaylor.com" checked="checked" />

that's all there is to it.

Mike said, on October 7, 2006 5:23 PM:

Hi Dave,
I'm been trying to find the right code to copy google's search bar with all of it's features, like images, videos, maps, etc. So far i've only been able to edit the script where the normal search works, but the images and other things don't work. Do you have a code or know where to get it?

Thanks,

Mike

Yoki said, on October 13, 2006 2:19 PM:

Hello Dave, Thank you for answering my earlier question. Your answer helped me understand the validation error message!

Keith said, on October 29, 2006 6:21 PM:

Hi Dave - I'm using frontpage to design my site and am having some problems with the search box. I copied the code you gave me onto my site and it doesn't seem to return any results. I understand that it won't return anything results from my site yet since I just registered with Google, but shouldn't it return results for searches outside of my site? Right now, when I click the button, nothing happens.

Help - and thanks for all the good advice.

Mohamed Hassan said, on November 6, 2006 10:41 AM:

Nice article, i have a simple question, is it legal to edit the google search form ,remove the google image and radio? i would like to do that on my site www.BadrIT.com.

Dave Taylor said, on November 6, 2006 3:35 PM:

Mohamed, I guess it depends on how you define "legal". There's no *law* saying you can't do that, and I really can't imagine that Google is going to notice or really care if you tweak with the script if you're sending them traffic. However, I do recall that the terms of service for searches indicates you shouldn't be monkeying with the script.

Muhammad Hassan said, on November 13, 2006 9:36 AM:

Thanks for your reply, i reviewed the terms of service but the only restriction i could found is that i must put google logo, can you tell me please where is the part that say not to play with the scripts, i am feeling that i may missed some thing!


Thanks.
Muhammad Hassan

Margaret said, on November 17, 2006 2:18 PM:

First thanks for all the helpful information. I imported the code and when I search "my" site, for a word, for example, Necklaces, it returns results from my shopping cart software, but not from my site proper. When do a Google site search for www.maggies107.com, I get the first page of my site, and the shopping cart data. What do I need to do to get the balance of my website to show up? Would including the sitemap for the Google information cure this?

Thanks for the info. Appreciate the service, as I am in the boonies with no other brains to pick.

u said, on November 28, 2006 1:09 AM:

This page requires Unicode support of your browser. You need "Arial Unicode MS" font to properly access this page. If you see any junk characters, square boxes or question mark, it shows that you do not have unicode font installed on your machine. Microsoft Office 2000 or higher version comes with this font. You can install this font from the Office CD. You may try to download particular language font from
If you think that font is already installed, try these steps.
1) Go to View Menu > Character Encoding.
2) Change the encoding to Unicode(UTF-8).
3) Refresh/Reload the page by pressing F5.

George Elliott said, on December 8, 2006 3:18 AM:

Thanks for the code. Great help!!!

Viscouse said, on January 9, 2007 7:42 AM:

Hi Dave! Wicked awesome plugin. But, I do have a query.

First: It works. No sweat.
Second: Whenever I add the code checked="checked" somehow after I submit the changes, it wipes that particular string out. nothing else, just that. Like it's invalid & trying to get rid of it. Any clue why? I can't get the code to make the box checked.
Alternately, I'd be happy with no check box, so it ONLY searched my site. I couldn't finagle the code to do that though. Any clue?
Thanks!

Roger said, on January 12, 2007 3:19 PM:

Dave,
Can I modify my "custom google search box" to just search a few specific sites, not just one?
Roger

Girish said, on January 13, 2007 11:32 AM:

Thanks for the code to add google search box in my blog. But i have a problem integrating wikipedia search within the same script.. i tried making another button for wikipedia but with no success with the search results. Since i am not that familiar with HTML, i couldn make it work. Is there any way u can make it work?
Thank you.

Thi-AIT said, on January 26, 2007 12:56 AM:

Dear Mr.Dave,

When I add your code into my blogger:


only search Ask Dave Taylor


It appear the following warning:

"Please correct the error below, and submit your template again.
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: Attribute name "checked" associated with an element type "input" must be followed by the ' = ' character. "

Please help me to solve this problem.

Thanks you so much.

Thi.

Karen said, on January 30, 2007 10:10 AM:

My server has a pre-coded search query box that searches just my site and does what I need for the most part. I am satisified with that aspect, yet is there a code I can insert within their code that will HIGHLIGHT the search result? I have an example for test search box on the url:

http://www.puddleofmuddfanpage.com/upchurch.htm

A search of 'Chicago' yields 13 results, but I have a lot of text on the site and I feel the users will get frustrated trying to find their keyword without a highlight tag.

Or another option, is there a code that will make it jump to the first result within the website, then a next button, similar to the search option for a keyword in Microsoft Word Document that will make it jump right to the next result?

FrontPage has an insert search box option, but I have a code conflict with my server and I'd rather just use the servers code and I insert their code manually. My site is new and hasn't been listing on Google yet so the Google search box isn't an option yet.

Thanks for all your assistance to others, I have been reading a lot of your site today.

Chaitanya Parekh said, on February 12, 2007 6:55 AM:

It was really fruitful and it was up to my needs it also proved to be inspiration for me i tried and found out Google Custom Search Engine

Ultimately very happy....

Karen said, on February 12, 2007 4:04 PM:

Thanks Chaitanya Parekh ! With a little work I finally got it to search all of my pages and not just the front page. Also for the ease of use for my visitors, I just added a message above the search box to view in 'cached' for their keywords to be highlighted since I have a lot of text on my pages. I appreciate your suggestion for to Google Custom Search Engine option. Up and running perfectly, thanks again.

Eric said, on February 21, 2007 11:43 AM:

How do you make a "Submit" button automatically pop up?

wayne said, on February 23, 2007 1:16 PM:

Hi I just wanted to say thanks for the code, I am currently having a problem getting the code to search my whole site though, here is my form,


It seems that it only wishes to search my index.html page and not search through all of my .html pages.

If you could get back to me that would be most appreciated.

Wayne

Karen said, on February 26, 2007 10:53 AM:

Wayne, that is the problem I had in the beginning, trying to get it to searc all of my pages. With more reading into the how to section, I found I had to add under the control panel/sites, some wildcard entries to have it hit all of my pages.

Fill in your site name and add each URL:

*.puddleofmuddfanpage.*
http://www.puddleofmuddfanpage.com/*
http://www.puddleofmuddfanpage.com/public_html

I have those 3 listed and it searches all of my pages. So it appears you should have a minimum of those 3 versions. It works with no problems, I added it to my front page in the left column if you want to take a look. Also if you type in a keyword, such as Chicago, if you view it in cached option, it highlights it to make finding the keyword easier. I have a lot of text on my pages, so I added those directions above the search box so users would be able to find what they are looking for easily. Hope this helps!

www.puddleofmuddfanpage.com


Dave Taylor said, on February 27, 2007 9:19 AM:

Wayne, is it possible that your site simply isn't fully indexed by Google? Try doing a search like site:askdavetaylor.com (with your domain name rather than mine) and see how many pages match. That's an easy way to see what's in the index...

wani said, on February 28, 2007 2:04 AM:

Hi Mr.Dave thanks a lot for the great codes.
It works fine on my site.but i dont understand why it still return the old contents.
But im not deleted yet the old file in my domain.
I just replace with the new contents and interfaces.
How can i solved this problem..thanks in advance

dana toppinen said, on February 28, 2007 6:36 PM:

what does script error 95 mean plz help it keeps coming up on mii piczo site i wanna no how to deletye it cause i can not edit anything plz help ..... thankz for the help .... xx dana

Colleen said, on March 3, 2007 5:45 PM:

re: Kontera and multiple web pages

If a person has a website with many many pages, what is the easiest method or manner to insert Kontera code on to each of those webpages?

Thanks...

Colleen

Dave Taylor said, on March 3, 2007 8:45 PM:

Colleen, I hope that you have some sort of template or other system built around a content management system (a blog, something like Article Manager, whatever) so that you can apply changes quickly? Failing that, some server-side includes (SSI) that lets you change one file and deliver up the changes to all of your pages? Otherwise, well, you have a tedious task ahead of you..

jon said, on March 6, 2007 7:54 AM:

Hi Dave I would like to add google search to my companies intranet homepage to search the internet, do you know how to do this using xml? Our intranet home page was built using flex2.

Damian said, on March 6, 2007 9:19 AM:

Thanks works a treat

Cain said, on March 7, 2007 11:36 PM:

Hi Dave,

This code is great, thanks. One question though: Is it possible to have only the text input field and submit button and it still search only our website, not the world wide web? I have no use for the radio buttons or the check box..

Cain said, on March 8, 2007 12:26 AM:

Nevermind! I used a hidden input type with our site address as the value and the "sitesearch" as the name and it works fine. :D

Ramesh Kumar said, on March 8, 2007 6:54 AM:

Hi,Dave.
We are one of the manpower agency and we would like to install Google search
engine in our website (www.jobonhand.com)to search suitable resume for our
employer view.I found that one of the web site installed the google
search engine on their site,
(www.amrood.com) please help me to avail the
facility.

Note: The google have sent me the key code, even though,i cant search what i want exactly.

naveed said, on March 8, 2007 1:38 PM:

I have a major problem i add google search box in my site but it only search for few static page of my site not for whole site .please tell why it is happening

Dave said, on March 8, 2007 7:57 PM:

Thanks Dave. I'm using your code on my site and it works great.

Todd said, on March 14, 2007 9:20 AM:

Dave,
How do you put a search box on a web page that will search ONLY that page?
Thanks in advance!

recep said, on March 22, 2007 4:30 PM:

dave, there are some of the strange google search box, like there is a backround int he search box, how can we do that ? l mean a backround image in search box and a default text "search in google" or some special features, can u teach us pls ?

Atiq Warraich said, on March 29, 2007 11:33 AM:

Dave, I was just wondering how do I take out the ads from google search? it's working fine but I don't want to have ads displayed on the University developed web site. any suggesions? comments?

Thanks in advance,

Regards,
Atiq Warraich
warraich@ur.msu.edu

BillinDetroit said, on April 6, 2007 10:41 PM:

Dave,
Very much appreciate the code. I narrowed the box and input field and dropped the border and it looks like it just grew there :-)

Now if I could just find some people who want to buy wooden pens, bowls or keychains ...

Oh well, Adsense won't pay the mortgage on my house yet, but it's almost to the point of paying for the website rent. Progress ... not perfection.

Tom said, on April 11, 2007 4:41 AM:

Hi i have the box on my web page but you can not search in in what do i do here?

Tauseef said, on April 16, 2007 5:55 AM:

Hie

I have a search option. In which there is a textfield and Submit Button. Before i press the button, i have two Radio Buttons.
1: Site Search
2: Google Search.

I want to have a check that when 2nd radio button is pressed it should go to google for search. Otherwise it should search within the website.

Can you help me implimetning these two?

Help much appriciated.
Many Thanks
Tauseef

Lourdes Metz said, on April 20, 2007 8:40 PM:

This web site is to search for words within the web site, so I would like to use my own search button like I've seen everywhere on other sites. I have seen the Google Search that gives you two options, to search thru Google or thru the web site itself, but when you chose to search thru the web site Google jumps in and the words you selected are listed with your web site link at an outside Google listing. I would like for people to type a word inside the search box and to jump straight to where that first word is and so forth. Is there an easy way to achieve this?

I'm not technical at all and time is of the essence to get this set up for our members and everyone out there. We conduct paranormal research and educate the community in the paranormal field.

I can even go as far as letting someone design my search button with that purpose and give him/her credit on the web site... This is an extension of a non-profit organization, Paranormal Awareness Society, Corp. and we need help.

Please help me.

Lourdes Metz

sami said, on April 21, 2007 9:44 PM:

Thanks !!! its work !!!!!!

nijyar said, on April 25, 2007 6:19 AM:

hi every body

David Cox said, on April 25, 2007 2:57 PM:

Thank goodness I found this answer I had done all sorts of searches and could not find code I wanted. Now the hard part. The code works fine. But is there a way to get the terms that people searched for from this form. That way I can learn better what they are looking for and tweak the content. This would be great! I am running on windows server and did not know if have to have database set up or could just get e-mail?

Dave Taylor said, on April 25, 2007 3:40 PM:

If you had access to your server, you could write a rudimentary CGI script that simply logged the search string and then bounced it to Google. That's probably a three line shell script in Linux, for example:

#!/bin/sh
logfile="yourdirectory/search.log"
echo $QUERY_STRING >> $logfile
echo "Location: http://www.google.com/search?$QUERY_STRING"
echo ""

exit 0

[caveat: not tested!]

David Cox said, on April 25, 2007 7:02 PM:

I set up an Access database on my site, but not sure how to get form to also place info into it. I am using dsn

Internet Marketing Tools said, on April 30, 2007 2:02 PM:

Just dropping by to say thanks for the great and thorough information, as usual. You are obviously a very dedicated and hardworking individual.

David Cox said, on May 1, 2007 4:55 AM:

Thanks Dave I will try this but I am not linux aware.

mahamoud said, on May 1, 2007 6:30 AM:

ku soo dhawoow website ka maxamuud,
boga heesaha
waxkabaro diintaada
khatarta intarnetka

daurie said, on May 10, 2007 11:13 AM:

does this google search tool work on a password protected site? or does that mess things up since the site is not available to all? thanks! d.

Guitar man said, on May 17, 2007 9:15 AM:

Hey Dave,

I just wanted to know if theres was any way that I can take out the padding on the search box? I want to put it in between my columns but I want it to fit snug tight without padding on top or bottom? Is that posssible?

Dave Taylor said, on May 17, 2007 12:17 PM:

You bet. Simply change that first DIV to remove the "padding" parameter:

<div style="border:1px solid black;width:20em;">

You can also tweak the width to fit your constraints too, including using a pixel count instead (e.g. "width:100px;")

Guitar Man said, on May 18, 2007 10:00 AM:

Thanks Dave! It worked great! You are definitely a gentleman and a scholar. Thank you for all your help, Have good one!

mike said, on May 21, 2007 3:19 PM:

Dave: I tried your example and it worked like a charm. The question I have is there a way to convert the results to an iframe without the google search bar showing up?

Thanks!

Badshah said, on May 24, 2007 2:08 AM:

Hi Dave
I Have the same query as that of nick,
"I added the Google site search to my site last year. But it does not find new content.

For example, I added the terms "yankee doodle dandy" to a test pagee recently, However, upon a "site" search, it does not locate the page with that term.

Can I assume that my site must be re-indexed by Google before any new content will be found? "

if so please suggest some simpler and faster indexing method as my website content changes frequently.
Thanks

Greg Smith said, on May 28, 2007 9:20 AM:

Dave,

Great site for those of us starting a website for the first time. My question: When someone does a google search from my site, can I have it first open a new tab if using tab browsing and if they don't have tabbed browsing, then open a new page?

Much Appreciated.

Dave Taylor said, on May 29, 2007 12:07 PM:

Badshah, you need to wait until the Google spider sees your new pages. One way for that to happen more quickly is to frequently update your site with new content, which teaches it to visit you more often.

Greg, yes, you can do that. Add "target="_blank" within the FORM tag and you'll find that the search results pop up in a new window.

osama said, on June 4, 2007 4:36 AM:

how can i search in my website by using google search

Badshah said, on June 13, 2007 7:36 AM:

thanks dave for the reply, i am not exactly getting your point that site should be updated daily, does it mean i need to add pages to website or just update/change the contents of the pages/pages already present?, now in either case whatever your reply is like adding pages/changing page content , if i do it on daily basis , does that mean google will eventully index my site daily as my site is should change almost daily and customers should see changes on daily basis too , waiting for ur
reply dave, Eagerlyyyyy

EJIRO said, on June 27, 2007 8:09 AM:

Hi dave, am having problems in locating html of my site, how do i go about it.

Thanks
Ejiro

Peter Armenti said, on June 27, 2007 7:16 PM:

Hello Dave.. I'd like to have 2 buttons instead of a google button and a checkbox.. how can I do this without the 2nd button having the full URL as it's face (value). In other words.. I would like the button face to say "LI Online" instead of www.longislandonline.com

fred s. hobbs said, on June 30, 2007 2:13 PM:

When I click on a location from Google's search, a different website shows up. It says "jump" and then loads a website i didn't click.

mastermind said, on July 11, 2007 9:59 PM:

hey. this is so cool. super. thank you very much for this info. cool cool cool! :D

Lou said, on July 12, 2007 5:14 PM:

Like Fred recently queried when I click on a location from Google's search, a different website shows up. It says "jump" and then loads a website i didn't click.

Martin LS said, on July 15, 2007 4:28 PM:

Hi Dave this is great thank you very much. Just wondered if you get could the search result to open a new window or tab (same as Greg Smith at May 28, 2007 9:20 AM).

Dave Taylor said, on July 15, 2007 8:58 PM:

Martin, as I said earlier in this stream of comments, yes, you can do that. Add "target="_blank" within the FORM tag and you'll find that the search results pop up in a new window. :-)

Jeff Stevens said, on July 16, 2007 10:18 AM:

do you know how I can make the google search box search a mysql database?

mmguuleed said, on July 18, 2007 3:07 AM:

We, as HornAfrik webmasters, are glad to join to the Google host page, please help us to find the easest way we can our website in an automatically?

So that, how can we deal with this matter?

Wish you the best.

Kenneth said, on July 19, 2007 1:22 PM:

How can I make this search box code, have google search two or three sites, instead of one?

thanks, Kenneth

Tom S said, on July 21, 2007 5:52 AM:

Hi, Thanks a lot for the feature, but how can I add a Google Image search?

Thanks,

Tom

Broken Pixels said, on July 31, 2007 10:03 PM:

Thanks Alot Dave .....

May God Bless U

lolman said, on August 5, 2007 3:50 AM:

how do i not give the user the option to search google.com, only my site?

Gail said, on August 15, 2007 6:46 PM:

How can I create a sign up box on my web site? All I want is to collect the name and email address of visitors who wish to participate.

Sajad Ghaffoor said, on August 15, 2007 11:26 PM:

You Rock Dave!!!!!!!!!!!!! Tanx a lot, I have a cool Search Box now on my site www.sajadghaffoor.blogspot.com tanx 2 you!keep up da good work

Arshad said, on August 20, 2007 10:05 AM:

Deve Great job,
I was using your control on my site(old site all html pages) and it was working fine today i upload the new site but the search my site is getting me old site results can you help me.

Dean said, on August 21, 2007 5:14 AM:

Hi Dave,

Many thanks for this, it's helped alot!

Cheers
Dean

Kawaljit Nagi said, on August 21, 2007 8:30 AM:

Do I need Google's permision to add google search on my site?

mujeeb said, on August 23, 2007 1:05 PM:

Dear contributor, copies the codes from this site and pasted it straight into a blank document under the body tag...unfortunately it was displaing the code i pasted under the preview.....PLS HELP ME OUT

PPC4YOU said, on August 23, 2007 8:59 PM:

My web site is www.ppc4you.blogspot.com. I cannot make my site on the google search even though i have submit my site into the google site map

matt said, on August 25, 2007 11:31 PM:

Just wanted to point out that the checked/selected attributes as used here are not actually XHTML compliant, as they are not well-formed. A well-formed attribute is in the form selected="selected".

Dave Taylor said, on August 27, 2007 10:34 AM:

Absolutely true. It's been a constant frustration that the code offered up by sites like Google and Amazon are often sloppy and need to be cleaned up to be standards compliant. Y'd think they could do better... :-)

avinas dwivedi said, on August 31, 2007 2:19 AM:

Thanks
after all you are master
thanks again!

Allen said, on September 5, 2007 10:02 AM:

hello u nailed my qustion right!
pls how do i have the google search results display on my site with out the google logo

saigonman26 said, on September 23, 2007 1:13 AM:

Hi Dave,
How to put the Google search (powered by Google)in my website like the www.cnn.com? Thanks

Alex said, on September 24, 2007 2:05 PM:

Thanks ALOT....I was looking for that...
I was wondering if I can add buttons to my search box like in google, I.E. image search Images News And Web...Thanks a lot again.

Bryan A. said, on October 2, 2007 6:46 PM:

How does one use a graphic as the input button/ submit button? I'd rather not have the Submit button but a gif instead.

Amy said, on October 5, 2007 3:57 PM:

Thank you so much for this awesome code!! Unfortunately, I am using this within a company intranet and when I click the search button, it tries to load in our intranet url and causes an error. It will not open in the web. I tried changing the code to open in a new window and it doesn't make a difference, our company url is still at the beginning of the address. Can you help (hope this makes sense)?

vinaym said, on October 19, 2007 11:18 AM:

Hi Dave,
Found your site and the excellent code snippets are great. Your teaching is very clear too. I thank you sincerely,
-Vinay

Sean James Cameron said, on November 3, 2007 6:49 AM:

I'm making a page and on the top left is the name of the site and I want the search box on the top right. I've tried doing it but it then doesn't work because its outside the red box. How do I also move the red box so that the search box appears top right?

Bob Nordele said, on November 11, 2007 12:40 PM:

How do I make a comment box like yours?

Janine said, on November 20, 2007 3:16 PM:

I am adding a google search and want an new window with a fixed width (say 600px wide)w ith the search results to open over the top of the website. How do I do that? Thank you so much for your help!

Victoria said, on November 21, 2007 11:38 AM:

When I run the search on my own site, I get results, great. But when I go to those pages, I get the text, but the images don't show. Any idea why? I added your search to a page in my help file, which I created in FrontPage (that has a sucky search feature), and my help file is hosted on a google-registered site.

leo r. said, on November 28, 2007 2:24 PM:

Thanks this code, i shall add this to my limo hire site shortly

Discover Nepal Exports said, on December 4, 2007 6:55 AM:

We want to add our pages in googlr pages because please guide to us.

Lesley Critton said, on December 4, 2007 10:11 AM:

Thank you, Dave Taylor for this website of yours. Humbly, a shy devotee

Saheer.N said, on December 9, 2007 11:33 AM:

Thank you Dave Taylor...For days I'm searching for this code. Finally you gave it..!! Thank you.

Tom said, on December 10, 2007 3:40 AM:

Dave, I've followed your instructions. However, the search term(s) do not transfer to the Search Page. I do get redirected to the search page, but then have to retype the serach terms. I am using my own search engine and NOT Google. Is the code different?

Dave Taylor said, on December 10, 2007 12:00 PM:

Tom, undoubtedly your search engine doesn't work the same way that Google does. Most importantly, you need to do a search and then look at the URL your search engine uses to identify the *name of the search term variable*. With Google, it's "q", and that's what this script produces too. If your system uses, say, "searchterm", then just tweak my script to use that variable name instead.

Lorinda said, on December 14, 2007 8:16 AM:

Hi Dave,

thanks for your code. I fairly new in this field and sometimes when i am stuck it takes for ever to figure it out. I have added a search to my site and changed the stle of it with some css, but it just won't work properly. i am looking up things that I know are in teh site, but it doesn't find them. Can you help?

Brandon said, on December 20, 2007 12:46 AM:

Dave, I have been pouring over this code and I can't seem to figure out why my search box won't fill the google search textbox when I click on the button. Do I have to use a submit button? Right now I am using an image for my button and I think that may be what it has to be. I am using IE7 and when I copy and paste your code it still doesn't work. They only difference in my code is the CSS id's, etc. That won't affect the functionality of the form.

What am I doing wrong?

ila said, on December 25, 2007 10:26 PM:

Hi Dave, i need to display the search result in my website itslef. Can you help me?

Charlie said, on December 28, 2007 10:38 PM:

Dave,
I was able to add the HTML by way of your instructions regarding adding a web-site specific as well as google search engine. When I do so all I get are no finds on either the website or the net. Any ideas what is going wrong?

Victoria said, on January 3, 2008 4:11 PM:

Hi Dave. Maybe I've missed this somewhere, but how do I get the search to only look at one directory in my domain? I'm looking for it to only search files in my help file, but not to look in the rest of the site. I'm unsuccessful. I looked at that bot thing, and i didn't see an answer.

So, for example, it currently looks at www.mywebsite.com, but I want it to look at www.mywebsite.com/directoryA

Is there a way to do that? Entering that path simply returns o results.

Thanks

Dave Taylor said, on January 4, 2008 8:25 AM:

Victoria, I've pulled your question into its own posting:

http://www.askdavetaylor.com/how_to_google_site_search_look_constrain_subdirectory.html

Hopefully that'll help you out!

Grace said, on January 8, 2008 9:36 PM:

Hi Dave. Thanks for this information, I have the google engine on my website ( www.mytravelicious.com) now. Just have a question- how do I put it on the center?

Many thanks

Dishon said, on January 13, 2008 8:09 AM:

Hi,thanks alot for ur help.
How do i pu the word (GOOGLE) b4 the textfield?
Pliz assist.

Regards,

Dishon.

Elsa said, on January 14, 2008 11:56 PM:

Thanks Dave, you've saved me!!!

Your site is one of my favorites now :)

Joe Holmes said, on January 17, 2008 10:21 PM:

I placed your google search on two of my web sites and they are great. Finditmall.com and citizenhealthwatch.com
Thanks for being a sharing person. The world needs more like you.

Mutahar said, on January 29, 2008 12:44 PM:

Dave,

My website's html layouts are fine in IE but in firefox there are some layout issues.

Can you please tell me how i can validate my website's html according to firefox and IE. The perfect solution which u recommend.

cally said, on January 29, 2008 9:47 PM:

dave, you seem to be telling alot of people who ask about opening a search in a new TAB, the "_blank" html code, which is to open up a new window... is there one for opening a new TAB. I can't seem to find a code anywhere, and a client has requested I incorporate this kind of feature in their site search.

Dave Taylor said, on January 29, 2008 11:37 PM:

As far as I can tell, Cally, there *is* no way to actually have a target= value that opens up a new tab; that's up to the browser software and indeed there are browsers that don't support tabs (for example, cell phone browsers).

Further, the entire target attribute is deprecated in the XHTML standard, so we should theoretically have stopped using it anyways...

Fawzer Faiz said, on February 2, 2008 10:54 PM:

Hi dave,

I need some advise regarding adding google adds on to my website.

I have given my URL above, and i got all the codes from Google and pasted on my website, but the adds doesnt seem to appear on my page, I managed to get the google search box on to my site. please help me with this.

Regards

Andrew said, on February 4, 2008 12:13 AM:

Brilliant!!!!
Thank you so much

Robert said, on February 10, 2008 8:51 PM:

Hi Dave, recently my Google image search button has stopped working. If I click the button leaving the query blank I get the Google image search page, but if I search for a picture it returns the regular Google results page, not the image results. It worked for months. Do you know what happened?

Alex said, on February 11, 2008 5:25 PM:

Hey Dave,
Do you happen to know of a way to add to the query string when the user types in a search?

For example: They type in "pit bull" and it actually searches for "dogs pit bull".

Elissa said, on February 11, 2008 10:16 PM:

Hi Dave,
Thanks so much for helping the HTML-inexperienced (like me) with these helpful posts!
My site is hosted on freewebs (http://www.freewebs.com/routedog) and when I search site:freewebs.com/routedog on google nothing happens. Is this because my site is new, or is it that freewebs sites never come up?

jack said, on February 15, 2008 3:53 PM:

Can you make the search result pop up in another window, like this HTML code for a link:

target="_blank"

Dave Taylor said, on February 15, 2008 10:53 PM:

Jack, yes you can do just that by adding that attribute to the FORM tag. So instead of having something like

FORM METHOD="get" ACTION="xxx"

you have

FORM METHOD="get" ACTION="xxx" TARGET="_blank"

tina said, on February 21, 2008 2:44 PM:


you said if l want to use this code l should simply change the occurrences of askdavetaylor.com as appropriate.only search Ask Dave Taylor
do l have to put my url here too? or what do l do .

value="askdavetaylor.com" checked /> only search Ask Dave Taylor


thanks

nikhil said, on February 22, 2008 9:28 AM:

hello Dave,

I have added your search code in my web page but it wont work fine. My web pages are in sub folder like "abc.com/xyz"

Can u help me

Tom said, on February 23, 2008 9:27 AM:

Hello Dave,

First of all great site, so much informatio.

I already use google search through my adesnse account and was wondering if it is possible to add my adsense code or to your code above or somehow tweak my google search box to look like the one you have made?

basicllay so i still get to use my google adesnse serch but have a different look.

Thank you for your time.

JGolden said, on February 26, 2008 8:30 PM:

Dave, I just wanted to say thanks. I have a site that's heavy with original content, and I've never been very good at archiving. It is absolutely AWESOME to have this tool for my readers. You're the best!!

Richy said, on February 27, 2008 1:26 AM:

Hi dave, thanks for your work, i have succesfully entered google search into my web page.But how can i make it an external link, i don't want it to open in the same window with my page.
Can you give me that code if possible.

I have also tried for several times to add my site into google but it's now about 4 months and it's not yet posted what could be the problem and what can i do?
The site is active and it's in use.
Thank you Mr.Dave.

Adspotlive said, on March 3, 2008 7:42 AM:

Thanks for the nice tutorial. I searched it for 3 days before comming to this post. You made my day...
Thanks....

pyrofool said, on March 4, 2008 8:59 PM:

how do you have it only show the search bar and no dial?

Ronnie Rokk said, on March 6, 2008 4:52 PM:

Dave, I have a new website that I bought that came with and without flash. I using the with out flash site, it much eaiser to use in Front Page. Any way my question is this. On the contact page I have a box for the person name and email that they can type in as well as a message with a submit button. How do I make this work when they click the submit botton. Do I need to add something to the code? I know how to make e-mail links and what not, but I'm not sure what to do on this. Any help is much appreciated.

lady said, on March 9, 2008 8:15 AM:

hallu dave! thnks for ur great tips! anyway, i am trying to create / design my own site using microsoft frontpage application which i plan to publish using free server ( for testing of course ).

Therefore, i hope you could help me to include google ads + google search box into my site which i created using frontage application? thanks ya!

Sam Shannon said, on March 20, 2008 1:33 PM:

Thanks! best help ive ever had!

tina said, on March 20, 2008 5:04 PM:

Hi. l just finished making one with google before l found yours . can l delete the google one and use your code. it looks cool

IdeaSmith said, on March 21, 2008 9:05 AM:

Thanks, Dave! This really works!

Brian Vail said, on March 21, 2008 2:02 PM:

Dave, I love these pages. Make more pages!!!!

Chris said, on March 24, 2008 8:38 AM:

Dave, I am designing a site for a friend who is an artist. She wants visitors to be able to search for images and be taken directly to that image. e.g. say she has a painting of a frog or frogs, if someone enters frog in a search box she wants all the frog paintings to show up. Is this possible? Preferably for free? Or am I asking too much.
Thanks for your help.
Chris.

Pat said, on March 24, 2008 8:01 PM:

Hi Dave, I'm a Realtor in Arizona and in the process of creating my 'website' and it is quite a challenge to me. How do I add the google search so it goes to my webpage?
Thanks,
Pat

Andres said, on March 26, 2008 12:28 PM:

Hi Dave,

is there any way to have the search function without the check box? so that it automatically searches your site first? The Box and text is taking up a lot of space and I'd like leave them out! :-)

Thanks much!

dan said, on March 26, 2008 2:16 PM:

how can I get this to work for google images dave?
Any php scripts out there if not

Rich said, on March 27, 2008 7:37 AM:

Hello Dave,
Was wondering if there is a way to get the google search, or any other search index to work within a password protected directory of a site?
Thanks,

Jack said, on March 30, 2008 4:38 PM:

Exactly what I needed, thanks a lot for sharing your knowledge. :)

Wong Xulu said, on April 3, 2008 9:19 AM:

Hi Dave. I must say you are doing a great job on this site. Thank the Heavens for people like you. I'm designing a Web directory and would like to find out if you are allowed to put a Google search box in your site without Google's permission. In the design I have already created the search box using the code I found on this site and I have also inserted the Google logo. Do I have to get Google's permission? Thanks.

PREFABRIK said, on April 3, 2008 1:44 PM:

thanks you

arti ajans said, on April 4, 2008 1:41 PM:

thanks a lot. its good comment.

Simon Shaw said, on April 7, 2008 4:13 PM:

Thanks, This is great

Verla said, on April 12, 2008 2:02 PM:

Can this be added to invision message boards? Is there any search that can be?
Thank you!

tourettehigh said, on April 18, 2008 1:25 AM:

Hi,

Can u please tell me how can i make this form, running inside an asp.net form ?
The main problem is that i want the google search form integrated inside the main asp form, ( which has the attribute "runat="server" ). If i exclude the code above from the main form, everything works fine, but the search form will flow after the first one ( so, teh search will be at teh bottom of teh page). If i include teh search form in teh main form, it wont work anymore :|.
Any solution will be kindly appreciated.

Thx,
tourettehigh

fxekobudi said, on April 18, 2008 4:21 AM:

Just say a lot of thanks for this nice tutorial!

Suryansh Pradhan said, on April 18, 2008 7:52 AM:

Hi Dave,
i have a blogger blog and want to add google search to it.But i can't figure out the code.Neither the code above nor the google free code works;my main concern is that it can search lines or words in side the blog posts.I think it will work, if you help me out with the variables.My blog is at theindianbuzz.blogspot.com

Mike said, on April 23, 2008 10:58 PM:

Dave,

I've cut and pasted your code for the Google Search and it works great, however, in the frame of the search box "maxlength 255 value=""/>" is listed. Also, at the bottom it also says "value=divine9online.com checked /> only search divine9online.co" Shouldn't that text be hidden in HTML view? Please advize. Thanks

Dave Taylor said, on April 23, 2008 11:06 PM:

Mike, I think your problem is that when you cut and pasted, you ended up getting some extra carriage returns in your results. The lines that you're seeing and don't expect to see, make 'em part of the previous line and you should be good!

Y4Yawar said, on April 29, 2008 4:43 AM:

Thanks for giving such a useful information. I have used your code on my webpage. It is looking really nice.

Thanks

Nikhil said, on May 1, 2008 7:50 PM:

How can i put current new from major web like google news, yahoo news, other etc which changes automatically with new change on the support web. I want to display news as html web links not by RSS.
Nikhil

Tom Melkonian said, on May 2, 2008 6:22 PM:

I have a question about the Google search box. I set it up and it works, but it doesnt seem to seach a new directory that I put in the location. it searches all the other directories under the top level, but not the most recent one I placed there. This has been the case for four weeks now. Any ideas?

thanks

Tom

Imran Rahi said, on May 15, 2008 7:01 AM:

Hi,

I am developing a site and I want users to enter keywords and look for similar pages on my own site. I mean the search should be restricted to my site only and I should show the listing alike google does.

Does google help us in such requirements?

Thanks in advance.

Yuda said, on May 17, 2008 5:31 AM:

How can i add a google search in my web (www.illusion.novoya.com)

jb said, on May 19, 2008 5:54 AM:

This must be some kind of joke. What are you doing coming up with 'solutions' using inaccessible tables and deprecated rubbish like target="_new"???? Ever heard of CSS and XHTML Dave? Bring your coding skills up to date, man!

Debbie said, on May 19, 2008 2:34 PM:

Hi, I am trying to build a family history site, but wish to keep living peoples information in password protected pages for security. Seriff web plus 9 does not do this, but they have suggested using a third party html code do you have any such codes or do you know where i could find them?

Dave Taylor said, on May 20, 2008 7:17 AM:

jb, of course I've heard of CSS and XHTML. Heck, I wrote a book about 'em. If you go back and read the code I present, it's certainly XHTML compliant. In terms of using "deprecated" elements like 'target', I find that the newer ways of accomplishing these sort of capabilities are so clunky and awkward, that I view it as typical committee-speak goofiness and ignore that it was deprecated. Just because something is agreed upon by a committee doesn't mean it's an improvement!

For example, it may be "wrong" to use something like <b> but if you don't want to learn CSS styles, "span", etc etc., it's sure darn easy for people to learn and remember. What's more important anyway, that it be "right" according to some committee, or that it be usable?

Josh Fialkoff said, on May 24, 2008 11:13 AM:

Hi Dave,

This is a great blog... thanks so much!

I am trying to use the Google Custom Search tool (http://www.google.com/coop/cse/).

The site I am doing this for (www.dawnnelson.org) is black, so I would like the results-page text to be white.

However, I need the query text to be black, because the box background is white.

I have looked through your blog post, but have not seen that topic discussed.

Can you please explain the best way to do this?

BTW, I had tried the AJAX version, but had the same problem with text color, so I reverted to the two-page version.

Thanks,
Josh

luise said, on May 29, 2008 3:53 PM:

Hi there-

Thanks so much for help with adding google search tool.

Next...how to add a box or something where it says, Digg this and Stumble this, etc.

Much appreciated!

Abul said, on June 3, 2008 11:11 AM:

Can u please tell me how can i make this form, running inside an asp.net form. because if i put this form inside the main form which has a "runat=surver" tag then the search doesn't work but if i put it outside of the main form, it works fine. Please help me to solve this problem.

Manila Boy said, on June 4, 2008 6:33 AM:

i've been trying to figure this out for weeks,
and thanks to you, i now have my own personal
site search.

as we say hereabouts,

"Maraming Salamat, Dave!!"

(many thanks, dave!!"

yilmaz said, on June 10, 2008 4:51 AM:

thanks dave :)

Michael said, on June 20, 2008 3:21 PM:

Sweet Post!

Google search is also a pretty good way to monetize your site by directing users to search through your site daily and often click on advertised ads through your adsense account-earning you cashola!

Trozza said, on June 22, 2008 3:10 AM:

Hay, thanks for the script Dave, worked great, but like a few other comments have asked as well, is there any way to search google images by simply clicking on a check box or something before hitting submit?

Thanks again
Troz

Richie said, on June 23, 2008 7:45 AM:

Keep up the good work.

I think by offering people the basics of coding then you don't scare them off, and therefore you give them the confidence to move forward and learn more.

There's no doubting that you're an intelligent guy, but you also possess a natural aptitude for teaching.

shantanu said, on June 25, 2008 1:22 PM:

Hi Dave,
This blog seems to be very helpful and hope my problem would be solved as well.I have pasted the code provided by you for the google search box in my site (http://dngc.tripod.com).
But the problem is that whenever I search anything within my site it doesn't searches all the pages rather it searches the index page only.I have used frames in the site,is that the reason for the problem.If it is then pliz provide me with a code so that it searches all the pages.

Mikle said, on July 5, 2008 5:57 PM:

You don't need google. The problem with google is that it index your site very randomly and not very often, so if you have a site which is very dynamic (i.e its contents change and new content is changed every now and then) then you need your own search tool as you want your users to get the latest results. The best that I have come across is Smart Spidey. It's the cheapest out there and works better than some of the most expensive search tool. It has a interesting Did you mean function and you can index your site anytime. Check it out at : http://www.smartspidey.com

george paily said, on July 12, 2008 4:38 AM:

I HAVE TO ADD A GOOGLE SEARCH BOX ON MY SITE

wsb said, on July 17, 2008 2:14 AM:

I know this is a few years old but THANKS. Was trying to solve this problem - had been using an icky widget for the past several weeks and had to look at GET WIDGET beneath it as a tradeoff - but this does the same thing, simply and more elegantly. On behalf of all of us who are BIG on content and SMALL on coding ability, thank you!!!!

Barry said, on July 21, 2008 11:21 AM:

Dave,

I've been trying to add a google search box on my website, however, when I copy the code you provide into a page on my website it gives me an error that says Internet Explorer cannot display the page. I am using Dreamweaver and have the page setup in tables. If I copy the code into a blank page it works fine. What am I doing wrong?

Suzie Tomkins said, on July 22, 2008 11:27 PM:

I am in the process of revamping our website and was looking for "how to insert search button into website". I was very lucky to have stumbled upon this site! Thank you Dave, I used your code to insert a google search bar :) YOU ARE A LEGEND!!!

robb said, on July 25, 2008 2:34 PM:

I Cannot Get The Code To Search My Site It Does Not Find Things but when i unclick the search my site only it searches for google
heres the code

only search ps3dexter.ca.tp


Any ideas what i did wrong?

Tj said, on July 31, 2008 2:53 PM:

Hi...
How can I add a Google (PDF, PPS, DOC, XlS, SWF) search box to my Web site?

I am trying to add special search on my website. I need to search for special file, I am looking for a search box with radio buttons to choose what type of file you want to search.

Thanks


cheryl said, on August 4, 2008 6:48 AM:

hi

i am currently developing in Visual web developer with a masterpage

when i add the code and click on the search it just directs me back to my page...if i paste the code in the head of the content place holder it still does not work??i am pretty deperate for it to work

aAnura said, on August 16, 2008 10:48 AM:

I HAVE BLOGSPOT WEB SITE I NEED ADD , GOOGLE SERCHING BAR, ITRY 5-6 TIME STILL I CANT ADD PLS HELP ME

Ralph said, on August 21, 2008 4:24 AM:

Hi, Dave,
I would like to add code to a web page on my site that contains a single form input field. I would like site visitors to have the cursor go right to the entry for that input field.

I think I read about that a long time ago and I have spent a lot of time today trying to figure out how to describe the HTML coding question. I like your site and I think you have already described this somewhere but could not find it.

You can email me at my email address that I entered if you have the code for that. And...THANKS for all the good help you have given; others have acknowledged the helpful info that you provide.

Signed -- Ralph

RAVINDER KUMAR RAWAT said, on August 22, 2008 11:57 PM:

I was looking for nice and attractive GOOGLE ADSENSE FOR SEARCH BOX. Is it legal to change the coding of ADSENSE FOR SEARCH??
Thanks

petter said, on September 2, 2008 12:20 PM:

Thanks Taylor. I'm using the code on my website and it works great.

K said, on September 3, 2008 12:10 PM:

Just wanted to say that your table/CSS suggestion above worked AWESOMELY for me, and thank you so much for the simple tutorial.

noughtypixy said, on September 7, 2008 7:17 AM:

want to give the choice between images and web search and have managed to get image search by changing the first line to
(form method="get" action="http://images.google.com/images?"target=blank)

have been trying to make an option to search all of the web but the way that I have tryed just adds it onto the end of the action rather than replacing it any tips??

here is what i have been trying that dosnt work
(input type="text" name="q" size="31"
maxlength="255" value="fairy" /)
(input type="submit" value="Search" /)

(input type="radio" name="sitesearch" value="" checked /) google image
(input type="radio" name="sitesearch" value="http://www.google.com/search?"/>google
(br /)

(/form)

in the actual code have used pointy brackets but that made it go invisibal here ;)

Branimir said, on September 11, 2008 2:30 AM:

hello Dave, here is the problem i am having, i have implemented your search box on my web site, but it doesn't work. I think it is a form problem. Could you have a look on my web site and add some suggestions. I will appreciated greatly.
Regards.
Branimir

jane said, on September 14, 2008 1:25 PM:

Is there a way to have a search for just one folder, for part of the site?
Ok, here is what I am doing, I have piggybacked a personal/family history and photographs site onto my main site, where I enter the url for my site, then a / then the folder name where the second site is with a new index page...

This part has gotten unwieldy and would like it searchable...
Is that possible? or is it un-google friendly?

noughtypixy said, on September 15, 2008 11:37 AM:

branimear you need to move the FORM eliments inside the DIV tags then it will work

Branimir said, on September 17, 2008 1:01 AM:

I did that, now it work perfectly, thank you for answer.
I have another question, why does the search engine list sites (database products) which a have deleted, in Google analytics that is shown as bad url, but the id number of the product (and product) doesn't exist in my database.

Jason Vandenbrink said, on September 17, 2008 4:07 PM:

Will google be okay with me following this advice? Also, will adding a link from my site to google affect my page rank at all?

sadek said, on September 19, 2008 3:52 AM:

how do u make the google search for all pages within ur site because i want the google search tool to search pages of mine such as www.freecoursework.co.cc/dida.html, can you plz tell me how i can add more sites for the search results.

surya said, on September 22, 2008 4:03 AM:

how to add the my website togoogle search

Fritz Lehman said, on September 23, 2008 8:44 PM:

Thanks a million! I had a good search box on my website once, but over time the code got messed up and it no longer worked. Also I think google changed their search box thing since then, so I can't make a new one (easily anyhow). This saved me! Thanks again, hope you don't mind that I modded it for my needs.

sadek said, on September 24, 2008 2:57 AM:

does your site have to be on google search engine before you can use this search tool?

Lyricist said, on September 26, 2008 4:04 AM:

nice post. I will try...

Simon said, on September 26, 2008 9:47 AM:

Hi David,

Great topic.

I have managed to get the code t work in a standard html page fine, however when I have added it to my CMS template...well nothing works :-(

I have no idea why this is, have you had any history with the code snipet being inserted into immediacy CMS???

Thanks,

Simon

Matt said, on October 5, 2008 11:33 PM:

Nice! This beats having to set up php!

Diane said, on October 7, 2008 11:46 AM:

Hi Dave,
How do i make the search box to search with a different search engine Not the Google search Engine and display the results on the same page and Not in a new window.
In your code you have "
" Can I replace the Action with different search eninges. You think this will work? or how do I make to search within our own search engine and within our own site.

Jim Ankan said, on October 8, 2008 11:30 AM:

Thanks for everything Dave....

cyndi whittley said, on October 13, 2008 8:51 PM:

This is pretty awesome, I've been looking for this code for a while for my site http://theinternetbiz.com

sud said, on October 16, 2008 2:41 PM:

Hi Dave,
How to add more than one website in my 'my site search' - i have two family sites, with common home page. Tks !
Sud

Discount Travel Portal said, on October 22, 2008 2:25 AM:

It's useful, however, I'd prefer to have a searcher that doesn't have the Google looks at all.

:S

LN said, on October 27, 2008 8:42 PM:

Thanks So much for the info- It helps me tremendously!

Pier said, on November 9, 2008 6:06 AM:

Hey Dave,
thanks for all the help re:adding google search box to web site... BUT, what I really want to do is have a button that when clicked will submit a SPECIFIC querry to google from within my web page.
I guess its the equivalent of replacing the querry box input mechanism with a predefined text string... how do I do that? or... maybe just being able to pass parameters to google search... is any of this possible?

Spider said, on November 9, 2008 9:14 AM:

This has been a massive help to me - been digging and thinking on this for months. My top tip to people would be to double check the scripting for typos when you amend it to your own website. Even though i copied and pasted, i still forgot to delete some bits when I added my own site details. it WILL and DOES work! If u have any probs, double check the script on your html page.
This worked fine in Frontpage 2000.
Thanx again!

Moustafa said, on November 11, 2008 5:12 AM:

Just was wondering how do you actually activate and use the google search? it seems like it you only to google's home page without submitting the query.

how do i fix it?

Dave Taylor said, on November 12, 2008 9:40 AM:
moreyn kamenir said, on November 16, 2008 10:19 AM:

So happy that I found your site! Everytime I put Amazon in my search box [on my regular explorer page], it gets me to Amazon, then adds tons of letters to my search and it flips over to Google image search and cannot find what I'm looking for. Even though it just took me off the page that I wanted. This only seems to happen at sites where cookies are needed. I have done EVERYTHING suggested to enable cookies. I am on medium security as well. Why is google image search stuck on to my yahoo search bar? Help? Thank you in advance for understanding and helping.

John said, on November 17, 2008 9:37 AM:

Hi Dave,

Being a bit slow, I wonder if you can help.

Rather than having to load the Google Toolbar, is there a way I can simply replicate the Google search box on my intranet, ie Search the web with a check box option for the World or just the UK.

Can you advise what code I need?

Many Thanks.

Regards,

John

iverson said, on November 17, 2008 1:53 PM:

do you know much about system development

Zii said, on November 25, 2008 10:06 AM:

Thanks for your useful google search codes hopefully i will be able to add them to www.ziigames.co.uk www.jllmarketing.co.uk www.pembrokeshire-sports.co.uk soooon!

faisal mehmood said, on November 29, 2008 7:06 PM:

please add this page if any body write azaan, quran naat on search bar.

Leee said, on December 2, 2008 10:24 AM:

Dave,

How do I add a search box & button as you have above that will search my site only, without having to have either the radio button or check box options? I just want to have the search box and button and nothing else..

thanks!!

Mike said, on December 10, 2008 11:09 PM:

Hi, is there a way to search two domains? I want two sites searched only.

Thanks

Danish said, on December 13, 2008 5:40 AM:

Dear Sir,

5 month before i was join NIIT they assured me that they will expert me in web designing after 3 month they told me your course is complete & they didn't teach me & eat my money Rs 4000/- thousand & give me a certificate, still i am trying to learn web-designing online. i make a webpage in frontpage but i hv a few problem that is my webpage is working well in my computer if i check another computer so the webpage is not working well i mean resolution problem.let me know the some tips about webdesigning any one can help me.

Nandy said, on December 16, 2008 5:07 AM:

Hallu.. Love you all...

Asif said, on December 17, 2008 11:01 PM:

Thanks Dave...Your code worked on the first try.. thanks for sharing...

nick said, on December 18, 2008 3:22 AM:

Hi Dave, ive been trying to get my contacts page to send the information filled in the form to be sent to my email address, but to no avail. i have mae the form in html and it calls a php file that collects the data and posts it. i thought this would work but it aint. please assist me.

Thanks in advance.
Nick

sam said, on December 19, 2008 8:37 AM:

can you add a comment box into freewebs?
I've tried but it doens't work

ASIF SHAIKH said, on December 22, 2008 5:10 AM:

Thank you Dave, this article has helped me very well. I am searching for this type of help from long ago. I will definitely divert my friends to this article. Thanx again

Nick said, on December 26, 2008 11:48 PM:

Great job, thanks for explaining how it works. You can also change language of the search in Google by changing the'action="http://www.google.com/search"

I needed Korean, so I changed it to 'action="http://www.google.co.kr/search"

Thanks

Daniel Bowen said, on December 28, 2008 7:21 PM:

Hi,
Just wondering wether it would be possible to make it search more than one site??

Tamina said, on December 30, 2008 6:21 AM:

<input type="submit" value="search" />

how do i make this pop up to a new window?

Dave Taylor said, on December 30, 2008 8:30 AM:

Tamina, just add

target="_blank"

to the FORM element. Not the input element.

suman said, on January 2, 2009 12:49 AM:

i have to add the search engine box in my web page.

Lon Britton said, on January 8, 2009 6:29 PM:

Dave,

I successfully added the Google site search box. I have an unpublished storefront of about 7 pages. How do I modify your code so the search will only search specific pages that I identify, ie. my storefront pages only. I know I must have the pages indexed by Google before the search will work. Each page is sequential and are named like so: storefront, storefront2, storefront3, etc. Will I need some wild card code or will I need to repeat each page. To clarify which code I'm speaking of I have pasted it below(it has my domain name inside). Thanks, Lon

Search Site box

<form method="get" action="http://www.google.com/search">

<div style="border:1px solid black;padding:4px;width:20em;">
<table border="0" cellpadding="0">
<tr><td>
<input type="text" name="q" size="25"
maxlength="255" value="" />
<input type="submit" value="Google Search" /></td></tr>
<tr><td align="center" style="font-size:75%">
<input type="checkbox" name="sitesearch"
value="outdoor-photography-topic-gallery.com" checked /> only search

Outdoor Photography Topic Gallery<br />
</td></tr></table>
</div>

</form>

weyons said, on January 11, 2009 9:11 AM:

add google to my site

Michael Claymore said, on January 29, 2009 8:46 PM:

Thanks for this, i wasted a lot of time before coming here. very cool.

Richard Sweeney said, on February 4, 2009 8:56 AM:

Nice. I (and I'm pretty sure LOADS more people) really appreciate these simple, concise tutorials.

Cheers mate.

kyle said, on February 8, 2009 2:46 PM:

when i tick the box it makes no difference it still searches google

waisuddin said, on February 14, 2009 10:33 PM:

hello dave
i a problem please help me my family are using my computer and they download everything from it so i decide to locke download could you please tell me how i can lock download .thanks

james said, on February 17, 2009 9:07 AM:

Hi Dave, Is it possible to display the google search results within a window on my website?

Brett said, on February 17, 2009 10:03 AM:

Hi Dave, Awsome stuff. I was wondering how you get a comment box at the bottom of the site like this one. How would I go about putting that on my site?

manu said, on February 18, 2009 10:55 PM:

thank u Dave! Its simple and it just works.
The box was a bit big on my Indian defence news site www.8ak.in, so I changed the size value and the em value, so its all looking nice and clean now!

Gordon Johnston said, on February 19, 2009 6:16 AM:

Hi DAve, I added a Google search on my web site, but my site index page is made up with frames, so when the search is used the google search opens up in just that frame, how can I make it open on top please

Dave Taylor said, on February 19, 2009 6:37 AM:

Gordon, add target="_top" to the FORM tag and it should do what you want. In other words:

<form method="get" action="http://www.google.com/search" target="_top" >

That should do the trick!

Colin said, on February 20, 2009 11:00 PM:

hello, i'm new to google search, i did added the search box in my web site, when i key in some keywords there some can pop up result and some cannot, and these items are on the same web page, why this will happen? and also sometimes when i search an item that is let say on page 3 of my catalog, but the goole search result showing that is page 2, why??
thank you

Louki said, on February 24, 2009 10:50 AM:

Thanks for your tips..!

Aamir Hasan said, on March 2, 2009 5:12 AM:

Thank U Mr Dave taylor i hv successfully added Google search in my web page
ThanX again

Ahmed said, on March 9, 2009 5:02 AM:

thanks , worked like a treat!

mrityunjay said, on March 14, 2009 6:21 AM:

THANX a lot..you made it easy to add google toolbar to my site..

Emir said, on March 16, 2009 6:43 AM:

How can you list your website with Google?

Craig said, on March 16, 2009 9:17 PM:

Hi Dave

I can't access Google Apps because my domain host suddenly is no more. I am currently trying to find a new host for accommodationalbany.co.nz.

In the meantime, because Google Apps only applies to existing sites, I went to Google Sites and set up what I thought was a web page, fairviewheightsbb@gmail.com. I cant find it on the web. I think there is another step involved to attract search engines. I am not familiar with HTML but does you advice about adding a google search box apply?. Do Google Sites attract search engines? Do I need a host?

Ab Razak said, on March 19, 2009 2:39 AM:

I need help for custom search engine html code that have by store, by brand & by category search button special for all my 70 online stores. Please help me!

Ab Razak said, on March 19, 2009 2:44 AM:

I got problem with my button. I already put the hyperlink but it seem unfunctional. Please give me a complete html code for button with hyperlink function.

rahim said, on March 24, 2009 1:02 AM:

how do i display the google search result in a same page? with the exact header and footer at my page..

Karim said, on March 30, 2009 4:59 AM:

Thank you brother

Gus said, on April 2, 2009 10:55 AM:

Hi,
I would like to add your code for this Google search but I was wondering if it is possible to not have the search web check option. I want to only allow searches on my website.
Is this possible and how can it be done. Thanks for the code I have learnt a lot form your website.

marius said, on April 11, 2009 4:34 PM:

Can anyone tell me if is possibile to make the search bar search in my password area?

Like the protected pages? I tipe a name on that protected page but nothing:(

So anywone ... Thanks in advanced !

ray said, on April 17, 2009 1:43 PM:

please tell me how to use the search box to search for more than 1 site at 1 time.
pLEASE tell if its possible or not. its really urgent.

Thank you

Mudassir Javed Khan said, on April 22, 2009 3:45 AM:

Dave
i have query form in my website but i dont know how to link that form with my email.

can you guide me?

Iqra said, on April 23, 2009 3:32 AM:

Dave

It works..........

Thanks a lot!

Mike S said, on April 25, 2009 4:58 PM:

Thank you, that was very clear and very helpful.

Eugene said, on April 26, 2009 8:32 AM:

Dear Dave,

Please help me understand what's wrong with my Google Search.

Google offers three alternatives, two of which work properly and the third one (the one that I need) - does not work at all.

1. search results in new window on Google site - works
2. search results in current window on Google site - works
3. search results in current window on page Search of my site - does not return results at all.

I am using iWeb widget to create SearchBox and SearchResults area.

Is it a problem of Apple's iWeb or is it a problem with Google code? Or am I a complete idiot?

quickcode said, on April 28, 2009 6:51 AM:

Dave,

Thanks for the solutions u've provided thus far.How do I add a search box to my website such that it conducts word search only within the website even when i'm not online.

nadeem said, on May 8, 2009 2:56 AM:

When I complete put the search box on my web site then the result show on new Google page and new out site my website theme. I want the search result show on my web site in ifram.
So can you give me solution on search result on my web page in ifram.
Thank you.

sartopsm said, on May 10, 2009 5:44 AM:

please help me

naresh said, on May 14, 2009 4:28 AM:

want 2 put add on googel.com

mojtaba said, on May 15, 2009 10:47 AM:

Thank you

vikalp said, on May 21, 2009 6:13 PM:

thanks a lot for your help.

Phenom? said, on May 23, 2009 9:29 AM:

Dude, WHY is question I made here not here??

Dave Taylor said, on May 25, 2009 6:55 AM:

Probably because it wasn't relevant to the topic at hand, so I either moved it or deleted it. Trying to keep things coherent and logical. :-)

Anonymous said, on May 25, 2009 9:59 AM:

"Probably because it wasn't relevant to the topic at hand, so I either moved it or deleted it. Trying to keep things coherent and logical."
What the hell are you saying?? It's completely about the topic, coherent and logical!


I have a Google search boX in my website, the first one Dave gave in the top of this page. It has two options, search The Web and Ask Dave Taylor with two input radio buttons before each one. You can chose which one you want to search.

Now I would like to know if this is possible and if it is how it's done: make the first option search the web only and the second option search google images only. Without having two different search boXes.


How is that not related to the topic nor logical??

Dave Taylor said, on May 25, 2009 1:53 PM:

Easy does it. I get a lot of comments and don't always recall why I do or don't moderate specific entries. Your question seems like a reasonable one and since the two use a very similar format, I expect it's doable too.

For example, here's a search URL:

http://www.google.com/search?q=my+search

and the same search on Google images:

http://images.google.com/images?q=my+search

So all you'd need to do is change the "action" field of the form if someone indicated they wanted to search images, not the full Google search. Let me poke around, see if I can come up with the necessary Javascript... :-)

Shaival Mehta said, on May 26, 2009 9:52 AM:

Thanx a lotttttt
It's great
and it do works........

Danielle said, on June 2, 2009 3:18 AM:

how can i improve my website please help!

david said, on June 3, 2009 10:33 AM:

dave, i tried your box but no search results came up. i just recently posted my site up. does this mean that the search engine hasn't crawled my site yet?

thanks

Dave Taylor said, on June 3, 2009 11:02 PM:

David, sounds like Google hasn't indexed your site yet. The easy way to find out is to search for your domain name prefaced by "site:" (I'd use "site:askdavetaylor.com" for example) and see if there are any matches. Then compare the total number of matches (you can find that in the top right) to the number of pages you know comprises your Web site.

Reny said, on June 8, 2009 8:07 AM:

I want to add google search bar at my website. I have created my website (www.autoasia.net) using front page. When I paste the code of Google Search Bar wherein I want to put the Google Search Bar, only the codes are shown in design mode. No logos and no search bar is shown there. How can I do that, please advise SIR.

James said, on June 15, 2009 5:44 PM:

hey there dave!
im currently using the google search code on my website, basicly i got bored and ended up makeing a home page how i wanted it which included google search, is there any way to get the search box to focus when the page loads (focus onload i belive this is called) every attempt ive tried its been able to focus however for some reason it disrupts the search angine and wont connect to google :/

vikas kumar said, on June 16, 2009 3:19 AM:

sir,
i want to know how to add in google.i want to launch a webside and using ur this search engine.what is benifit for me? plz tell me soon.

Amy said, on June 20, 2009 2:54 AM:

Hey Dave-
Thanks for this script- it's slick.
I have a problem... I just changed from a blogspot.com to my own domain. I put a robot.txt in my root folder to stop my old site from showing up in google searches. I also did a mass url removal (per google crawler access)...
here is my question... since I went from blogspot to my own domain, and I have blocked google from crawling my files by putting the robot.txt in my root folder, am I now unable to have my own google search in my website? Will these blocks affect my own personal site search?

Thanks!!

Dave Taylor said, on June 20, 2009 7:07 AM:

Vikas, the benefit to using Google as a search engine is that it does all the work for you and you don't have to worry about a site-specific search engine and maintaining it locally...

Amy, you're right that if you are blocking Google from spidering your site by use of a robots.txt then this script will be useless to your visitors because it won't be able to search what you're not making available. You might check out http://www.lijit.com/ instead as a third-party blog search engine instead.

Muhammad Ismail said, on June 21, 2009 9:43 PM:

Thanks a lot it is very useful God bless you.

Ericard Production said, on June 22, 2009 10:41 PM:

Thank you! It works alot and very useful for my homepage. ericard.webs.com

jennifer said, on June 24, 2009 6:07 PM:

Hi dave. I am having a lot of difficulty with my website. I signed up with google adsense and i followed the steps. When I got to copying and pasting my html code they gave me, I get error on my page. I have tried created side bars and saving it and publishing it that way and I have been trying to add widgets and i copy my code but nothing. I am seeing ads by google on my site but no code. Its really werid and fustrating. I have been trying to do this for 2 weeks and been trying to get some online help and posting questions on the net. I am getting nowhere. Can you help me?

freddy said, on June 27, 2009 11:25 AM:

Thanks for the code - it works great - better than the standard google widget offering and I have started using it on my sites

Freddy

rochelle said, on June 28, 2009 7:50 PM:

thank you you just help me better working on my website.

Mr.Me said, on July 7, 2009 7:35 AM:

Hi Dave,

Thanks for the code, but can you tell me how place an image search button on the same page as a normal search button, I have tried myself but I can't seen to crack it.

Thanks, Sam

Dave Taylor said, on July 7, 2009 8:20 AM:

Sam, not sure what you're asking. If you want *buttons* then you can easily have something pointing to images.google.com. If you want multiple search boxes, that's easy too, just make sure that you have each form (that produces the input area and button) end with the </form> tag: many web site builders seem to be predicated on you having no more than one form on a page.

Anonymous said, on July 15, 2009 5:43 AM:

"Let me poke around, see if I can come up with the necessary Javascript... :-)"

Do you have anything?

Scott Herman said, on July 15, 2009 2:05 PM:

Hi Dave: Please don't post my website in your public response. I am trying to add a search function using lotus notes (not my choice). We have a document library that is an https site. Ideally we'd like the search engine to go there. When I write this code in lotus notes - it appears fine. But when I search either "the web" or internally, I get the following error: HTTP Web Server: Invalid URL Exception -- can you explain why? And honestly, more importantly, how I can fix/work around this? Thank you! Scott

Dave Taylor said, on July 15, 2009 10:13 PM:

Scott, I'm afraid I don't know enough about Lotus Notes to be able to assist. Seems like if you can create a search box on a blank page, though, you should be able to cut and paste that same code onto any page on your site. Good luck!

Mark said, on July 25, 2009 8:41 PM:

Dave, in your reply to John Kiester, you said " just needs to have target="new" added and it'll redirect the result of that form to a new window called "new"". If you always...."

My question, How you change the Google search box and it is violate the Google policies?

Dave Taylor said, on July 26, 2009 12:03 AM:

Mark, we're not tweaking the search results window, we're just ensuring that it shows up in a separate window, rather than the same one. I really can't imagine Google caring (or even having any control over it). I'm sure it's not a terms of service problem.

Mary said, on August 4, 2009 4:38 PM:

I tried the free site search instructions on your url:http://www.askdavetaylor.com/how_can_i_add_a_google_search_box_to_my_web_site.html
and it does not work. Is this an old suggestion now that Google charges to have an individual site search button? Wish it worked!! It just goes to the traditional google search page and you have to just enter what you want, no mention of my website..bummer!

Dave Taylor said, on August 4, 2009 5:09 PM:

The first question to ask, Mary, is whether your site is in Google in the first place. If so, then try doing some searches like

site:yourdomain.com test words

(where "yourdomain.com" is your actual domain). Do they work? Do you get results? Then you should definitely be able to get the search box here to work.

Paul said, on August 7, 2009 10:50 PM:

I have just tried your search box and it works fine on my site. Just wondered what code I need to add, so as to center the entire box instead of it being on the left

Yolanda said, on September 2, 2009 10:25 AM:

Many thanks. Works perfectly.

Jim said, on September 12, 2009 9:11 PM:

I have seen the question asked many times but I haven't seen a response. Is ther any way to eliminate the advertisements in the results?

Thanks

Dave Taylor said, on September 13, 2009 12:03 AM:

Jim, why would you think that there was a way to avoid having the advertisements on the search results page? :-)

Ken said, on September 13, 2009 9:20 AM:

I just wanted to say thanks for the great tip on the HTML code for the Google Search Box. I could have figured it out but this made it much easier.

Now I have it implemented on a custom start page for direct searches and to avoid their enlarged text and text box search page.

Jim said, on September 15, 2009 8:54 AM:

I found how to eliminate the advertisements. You need to pay $250.00 per year or more depending on your requirements.

Eli said, on September 17, 2009 12:42 PM:

Dave,
How would I turn the google search bar into a link? For example, I would want anything you put in the search bar and what you press to not matter, but only to send you to another page. Please get back to me soon.
-Elias

Tamar said, on September 18, 2009 1:24 PM:

thanks for telling me how to add a search box to a website. Been wanting to add one to the Barradrum Farm (www.barradrumfarm.ie) website for ages. In my tests it is working perfectly, Thanks again, Tamar

Dave Taylor said, on September 22, 2009 6:34 AM:

Elias, I don't know how you would access the information someone has typed into their Google search bar, so I dunno how to do that.

Gail issen said, on September 23, 2009 1:47 AM:

Thank you for a great script!

Now, I would like an enhancement. Is there any way I can have the results of the search display within a page on my site?

Diana said, on September 24, 2009 9:50 AM:

Thank you Dave!

vijaykumapeta said, on September 26, 2009 11:02 AM:

thanks dave. you made my life easier. I have been looking for this for ages.

Ingo said, on September 28, 2009 4:04 PM:

Thank you for the code to start a Google search. Worked on first try. Was using free Pico Search but they don't search pdf files unless you pay.

Allana C said, on October 2, 2009 4:27 PM:

Hi Dave, perhaps you can help me - I have added a Google custom search box to my homepage, and redirected the results to a page called /searchresults.aspx. When I try the search, it goes to the right page, but doesn't show any text at all.

If you are able to take a moment to look at the code, you will see the only difference there is to the code google issued me with is the "defer" command, which microsoft office live added itself.

Thanks in advance!

bursa said, on October 4, 2009 5:41 AM:

thanks dave. you made my life easier. I have been looking for this for ages.

Big John T said, on October 4, 2009 6:43 AM:

Dave,

This is exactly, well almost exactly but close enough to what I was looking for. Excellent, clean, short nice. The only improvement I did was to move the "search" button to the right of the text box. Sometimes when suggestions pop up they cover the search button.

Thanks for sharing this.

John

satish said, on October 4, 2009 10:35 PM:

I added the google search box!SUCCESSFULLY..... THANK YOU SOO MUCH!!!!!!!!!!

Tamar said, on October 5, 2009 6:45 AM:

Have published the site now with the search box, thanks again Dave, Tamar (www.barradrumfarm.ie)

alvin said, on October 6, 2009 9:27 AM:

Hi Dave,
i still have one question.Your program works fine but how do i get rid of the checkboxes and force the user to only search for my sitedomain?
Thanks.
alvin

alvin said, on October 6, 2009 8:26 PM:

Sry,another question...
Can i search for information only in a certain folder under my domain? Example testing.com/Folder?

Jaivardhan Joshi said, on October 8, 2009 3:52 AM:

Thanks Dave 4 the article. I was wondering if i could redirect the output of search to some div in my webpage rather than making the whole page redirect to google. I need help on this.

Thanks in advance

bursa haberleri said, on October 8, 2009 8:34 AM:

Sry,another question...
Can i search for information only in a certain folder under my domain? Example testing.com/Folder?

gaste bursa said, on October 9, 2009 3:21 AM:

Have published the site now with the search box, thanks again Dave, Tamar (www.barradrumfarm.ie)

Jaivardhan Joshi said, on October 10, 2009 3:28 AM:

Hi Dave, I have managed to do some tweaking with javascript so as to enable muliple forms in a page, so as to enable the page to do some other postback also rather than just searching.


function abcd()
{
var i = document.getElementById('A1');
var j = document.getElementById('q');

if( j.value !="")
{
i.href = "http://www.google.co.in\\search?q=" + j.value + "&sitesearch=cyborgit.in";
}
}

Where A1 is the link



I hope it helps some one....

but my question remains...... can i redirect the google search to some div within my form

elric said, on October 10, 2009 3:58 PM:

hi dave I found this very useful. Please email me after looking at the website and rate it. Speaking of rate you should show how to put a comment box or a 5 star rate system thanks alot

guduru phani kumar said, on October 14, 2009 10:17 PM:

hi dave, my doubt is how to link my hyperlinks to my google adsense search box and it should get the result page.
example: when visitors click hyperlink of wallpapers on my website it should get the search results from my google adsense for search.
please provide solution for this problem.
thank u

Rob said, on October 25, 2009 4:10 AM:

Hi,
I want the results to appear in an ifram on another page on my site .. how do i do this. I have tried using target="iframe_name" but it just opens the results in a new window. I use Webplus X2

Emmanuel Acquah said, on October 28, 2009 6:03 AM:

Thanks Dave. Helped a lot!!!

Heather G said, on October 28, 2009 2:22 PM:

Hi,
Thank you for having this website and continuing to answer questions on this topic. I have a google search box on my website and I am wondering if there is a way to have a hidden search term which will always be included in the search. For example, if you wanted to always include the word "wiki" as a search term. Is there a way to add this as a search term so that when a user types "puppies" it actually searches on "puppies wiki"? Thanks.

Andy said, on October 30, 2009 5:55 PM:

Thanks for the help this is useful.

aakif said, on October 31, 2009 7:09 AM:

I want to add a radio tab along with others for image search, please help!

G. Subhra Isaac Stein said, on November 2, 2009 11:10 AM:

Dear Dave,

You are doing a great job for web professionals. I have one small doubt, please guide me. I have one website named www.logontowww.com . (1) In this site can i use the code shown below?

[form method="get" area target="_blank" action="http://www.google.com/search"]

[input type="text" name="q" size="31"
maxlength="255" value="" /]
[input type="submit" value="Google Search" /]
[/form]

(2) Is there any terms or rule violation for using this feature ?

Andreja said, on November 5, 2009 6:51 AM:

Dear Dave,

only Research page of my site is in search results... why is this happens?

All the best!

Linda Smythers said, on November 19, 2009 5:22 AM:

i have tried it and it works very well.

CHILLAPPLE said, on November 19, 2009 8:41 AM:

ya its very useful for me... thanks a lot...

Kevin Daniel said, on November 20, 2009 5:17 PM:

Dear Dave,
I was flipping through the web pages while looking for a search engine I found your website to be very interesting
I have my website which is under construction, I have a search engine installed into it but getting that into function is the big problem can you please help me in regards to this.

Thanks.

pc stomp said, on November 21, 2009 7:05 AM:

how do i get a thumnale photo to showup on google
next to my url can you help me thanks.
p.s i am willing to ad your url to my website if
you whant as a link so otheres can fined you thanks

Long Islander said, on December 4, 2009 9:23 PM:

Dave, you rock. Thanks for the quick and easy code, which works great!

JOSE said, on December 5, 2009 9:04 PM:

WE CAN DO WHATEVER YOU WANT!

husen said, on December 8, 2009 3:44 AM:

songs

Dillan said, on December 14, 2009 6:08 PM:

I'm still in the process of creating my site with Adobe Dreamweaver and I have the search bar on the site, but I cannot type in the search box when I preview the site or while I'm working on the site. I am extremely new to this and was wondering if I am doing something wrong. I know absolutely nothing about HTML and don't have the time to learn it by the time i need this site finished, which is in a couple weeks. Please Help ASAP.

Thank You and God Bless,
Dillan

Z R Abbasi said, on December 17, 2009 12:51 AM:

i want to submit my site on google search engine but unable

any body can tell me about it please

Mike said, on December 17, 2009 10:11 AM:

I am so glad that I found this website. I wish Google natively had a way to differentiate a site search or search the web with the radio buttons.

Thank you so much for showing how to add the radio buttons!!

bachchu said, on December 21, 2009 8:41 PM:

Please help me to get more visitor . I have done my website before three or four month ago . I include google search tool box and best link search code. Yet I do not get visitor. my site is complete blog site . Education, Health , and photography tips with other... so please help me to get visitor..

Thanks...
Bachchu

Jake said, on December 23, 2009 2:35 PM:

I'm so glad I found this site - I'm working on my gsce project at the moment and little items like this - which not only work first time but have also taught me about it and how to do (I've spent hours searching for a simple tutorial on a search bar!) will help me so much!
Thanks and keep it coming!!

justin said, on December 23, 2009 4:40 PM:

hey Dave,'i have a free account with google sitesearch. is there anyway that i can put the results on a different page like u have it instead of having it pop up below?

ZAFAR said, on December 26, 2009 7:49 AM:

how i add google on my site?

Laneo said, on December 30, 2009 6:47 AM:

Hi Dave,
I've seen you are not replying since months, so i hope you read this.
What i'm missing with this searchbox are the google suggestions as you type. I find them so usefull that will make this searchbox unusable to me.
Do you know how to achieve that ? btw, i just want to search the web from my site, not to search my site.
Thanks for sharing what you know!
Best
Laneo

Dave Taylor said, on December 30, 2009 8:12 AM:

Laneo, that's an interesting question: can you get Google search hints on a search box that is on your own site? I have never seen anyone accomplish this and have never really dug into how it's done on the Google home page, but my instinct is that no, you can't do it. Perhaps someone else can show otherwise?

Zal said, on December 31, 2009 6:51 AM:

Hi. I just want to ask if there is a way to change the google search box just like in this link:

http://educational-trafficandeverything.blogspot.com/

Pls reply thanks

Dave Taylor said, on December 31, 2009 9:12 AM:

Zal, what am I missing? Just remove the border and drop the search button to below the input box and you have the same search box as that blogspot page? Or are you sneakily trying to get us to visit your blog? :-)

sophie said, on January 2, 2010 2:32 PM:

Hi Dave, I am currently creating a website for my Uni semester on Notepad, and I want to add a Google search bar, the code is working fine on IE but when i load it in Firefox nothing displays. This is a problem because it needs to be user compatible. Is it right it just works on IE or have I dont something wrong?

Tala said, on January 4, 2010 2:49 AM:

Hi Dave,

This is a great article and it is very useful, thank you.

I have a question, I would add the results in iframe without the google search box, can I do that? I just saw it in a blog and it is really nice, where our website header and footer still displayed and only google results displayed in the iframe.

Thanks in advance for any help

Mohan`` said, on January 5, 2010 12:37 AM:

Hi Dave,

I was trying so hard so far to find an answere to this but couldn't.. As you may see im and infant to web development and great if you can drop a line to this.


I need to place a text box in my web page in a position desired. This I want to do without putting it in to a table cell.. is this possible?

Many Thanks,
Mohan

Khushboo said, on January 6, 2010 3:47 AM:

Hi,

I tried to implement the search code in my ASP.Net page that is .aspx page but it didn't worked.

--I have put runat="server" with form tag as I am having some more controls on the same page for which I need to have runat="server" with form.I tried posting my code.But this site don't permit that.

Please resolve my problem.

Steve said, on January 8, 2010 12:45 PM:

Worked like a charm. Thanks a lot for this excellent tip.

Sam said, on January 11, 2010 4:52 AM:

Ok so i have put in the code and have added the code to my new site....which is still work in progress www.cheap3d.net problem is when i type something in there it takes me to google without a search result

what am i doing wrong?

Dave Taylor said, on January 11, 2010 6:50 PM:

Khushboo, it shouldn't matter that your page is a .aspx page, as long as you can create a box of HTML that's not interpreted as ASP. I don't have a clue about that language, though, so I can't offer any suggestions.

Sam, look for line breaks within your HTML and make sure that every line that has an open "" all on the same line. That should help!

Khushboo said, on January 12, 2010 1:14 AM:

Hi Dave,

Thanks for your reply.
These are the line of codes I am implementing in my .aspx page i.e ASP.Net page.

[form method="get" action="http://www.google.com/search" runat="server"]
[input type="text" name="q" size="31"
maxlength="255" value="" /]
[input type="submit" value="Google Search" /]
[input type="radio" name="sitesearch" value="" /]
[input type="radio" name="sitesearch"
value="askdavetaylor.com" checked /] Ask Dave Taylor
[/form]

If I remove runat="server" from the form tag it works fine, but if I put that its stops working, please tell me is there any solution that this code should work with "runat="server" in form tag as well.
As I need to put this to make my other controls active.

Thanks..

omar said, on January 12, 2010 7:46 AM:

Hi Dave, I thanks in advanced for helping all of us in fixing our websites. My question, I am using flash cs4 to build my website and i would like to know the code to add yahoo, google and MSN search box in my site. i want those 3 to have their own search box like the little one that comes in the regular website. thanks.

leo said, on January 14, 2010 6:29 AM:

Thanks, i found what i forgot about this html code. Now it's clear.

Mir Wais Nisar said, on January 15, 2010 7:04 AM:

hello dave,

i just want to know how to make a guestbook in classic asp which should work with form tag of html, which could able to put all the comments from form to ms access database

Pauline said, on January 16, 2010 2:08 PM:

I am searching for the same question that has been asked, and still I can't find the answer. That is not what he asked, he and I want to know how to put web search and your own site search.
Why is this so hard, I have seen many sites with this under google search bars, and have spent hours trying to work it out and still no answers.....
Why don't people read what others are saying.

Pauline said, on January 16, 2010 2:25 PM:

Sorry Dave,
I take back what I just said..... Obviously I was'nt reading to well myself.
Thankyou for your help.

Jenny from Find Someones Email said, on January 21, 2010 5:02 PM:

Thanks for this Dave. I have been coming to your site for ages and I never fail to learn something new.

Bobo Benson Kurgan said, on January 22, 2010 8:28 AM:

Its very disgusting to say that i don't know how to connect my website to the google searching engines..........................................

conn said, on January 23, 2010 10:07 PM:

i have it set up but i wont work when i type a keyword in it says it has no results

Bill said, on January 24, 2010 11:44 AM:

Hi Dave,

I tried to add the "Google search" into my HTML editor (front page), but the only thing that shows up is the HTML code on your site.. I may be adding it to the wrong place in my html...I am not quite sure where in my coding I would paste your code...It is very confusing...I could email you my home page in html, but I am not sure that would be helpful... Any suggestions where to cut and paste your html code?? Before tags? after tags? HELP???!!!!

Bill

alan said, on January 26, 2010 4:03 PM:

this post has been so helpful, i always wanted to learn how to add google search box in my website and heres the answer, a magnificent post. thanks alot.

niraj said, on January 27, 2010 11:00 PM:

thanks friend

Ray said, on February 7, 2010 8:46 PM:

I have spent so long trying to figure this one out my self. Thank you so much for making is easy. The code worked perfectly. Ray

Ben said, on February 8, 2010 10:35 PM:

I've successfully added Dave Taylor's "How can I add a Google search box to my Web site?" html script to my page.

I'm wondering is it possible to do a google custom site search so it does my site and another...

Usage Example:

Option 1: Search "DELL AUSTRALIA"
Option 2: Search "ALL DELL SITES" (USA, Germany, Japan etc)

sourabh thukral said, on February 9, 2010 4:11 AM:

thanks friends for giving me google search engine code in html.

michael wolf said, on February 10, 2010 7:35 AM:

Dave,

THANKS for the great Google Search box!

Problem is after the search is used or the page is
accessed again the background go completely white!

The only way to bring it back it to hit refesh?

I REALLY want this but my page disappears afterwards? Any Ideas?

Thanks Again !

Dina said, on February 10, 2010 8:49 AM:

Hello Dave,
I need to know how to add multiple search sites in menu and use only one text field to take the term.
user choses the search engine, then inserts the search term, and finally presses the go button that will take him to the results page from that search engine.

thank you.

marc said, on February 16, 2010 9:39 AM:

dave, thanks for the code.. was wondering if it can be tweeked to search 'this page only' where the item(s) being searched is/are highlighted on the page.

thanks!

James said, on February 19, 2010 4:35 AM:

would you know how to make something like this but instead of searching add a comment to my myspace profile? like what i used to post this comment. ? i really want this!

Rebecca said, on February 20, 2010 11:45 AM:

Hi Dave, I have acquired a Google page that opens with "test" in the search box and a full page of articles with "test" within them. I have tried to uninstall and even overinstall but now Google does not even appear in my list of programs. Alss, my AOL page is truncated and I can only read a portion of the e-mail description. This happened shortly before I installed Pareto File Cure and tried to install some of the "free" apps it said I needed. It was after this that I got the Google "test" search page. I installed SoftSpy and heretofore, as now, I use a WinSock XP fix which has worked well to keep me clean until now. Please help if you can. Thanks!! Rebecca

Marguerite Hamilton said, on February 22, 2010 3:12 PM:

Hi Dave,

I really need your help in solving this problem.

Google has always updated by website within 1 to 2 days of my making changes or adding content.

The last date they crawled my website was February 13th. I made some changes on February 15th and now (no matter how many times I submit my url or use my submitter.net for submissions) no updating is occurring.

It seems as though Yahoo and Bing have updated my website and Google has updated other pages in my website EXCEPT for the Home Page.

What is happening? I am starting to be concerned.

Alo, how do I get Google to use my description rather than other snippets they choose. Sometimes, they just list my categories in the left navigation.

If you need my website address, please let me know.

I thank you in advance for any help you can give me.

Maggie

--------------------------------------------------------------------------------

budi said, on February 25, 2010 7:46 PM:

great site. great information this post helped me out alot. Thank you :)

harsha prabath said, on February 25, 2010 10:50 PM:

hnpwap free download

Oscar D'Antona said, on February 26, 2010 11:00 AM:

I am a total rookie, I have not tested yet .. but thanks a lot just to start with ..
oscar
unixrat@hotmail.com

Dustin said, on February 28, 2010 4:48 PM:

Very Helpful... thanks!

Andy said, on March 3, 2010 6:16 PM:

Dave, I was able to place the google search function on my site however I seem to be having a problem. We need to search in Japanese. It seems that when I type in Japanese text and then hit "search" it defaults to ascii characters and not Japanese characters so the search fails. However, after the failure, if I *then* type in Japanese it works. If I type in English from the get-go it works. I need for it to work in Japanese from the first step and not after it errors-out. Any ideas on what is going on and how I can fix the problem?
thanks,
Andy

Junaid said, on March 5, 2010 5:50 AM:

How can I add a Live Date & Time box to my Web site ?

Jitendra kumar said, on March 9, 2010 9:33 AM:

please tell me about How i can google add in my site.

Sid said, on March 9, 2010 3:26 PM:

Hi Dave,

I am creating a comparision site about lease and I am not sure how to get affiliated my websites to other leasing companies so that if someone clicks on their link i get paid and when someone signed up i get commission on it, is this something you can guide me about, please? thanks

SaefAllah said, on March 22, 2010 11:04 AM:

I figured out how to search ONLY on my site without giving checkboxes or radio buttons for google, etc. Just remember to change your site where it says ENTERYOURWEBSITEHERE...





Gina said, on March 24, 2010 7:49 AM:

Thank you for the article... I was able to get the search to work, However when the results come up... it seems like the www is missing so when you click on the hyperlink that google returns it fails on load. Can someone tell me what I need to do to fix that ? This site is Https and I am not sure if the full url needs to show? or how to make google show it ?

Jasmin said, on March 24, 2010 12:16 PM:

I'm trying to create a mobile portal for myself, and changed the URL to the more PSP-friendly "http://www.google.com/m". Only, once I do that, the site-specific checkboxes stop working. Is there any way to get the checkboxes to work with the the mobile Google site?

Wendy said, on March 24, 2010 1:23 PM:

Amazing! Thanks!

O. Shashi said, on March 26, 2010 5:16 PM:

hi this helped me to keep in my site so that visitors can search
Thankyou!

joe richardson said, on March 27, 2010 1:44 PM:

Hi Dave,

Thanks for your info. I have used it to provide a site search facility on a site which I maintain.

I was very pleased with your information, as implementing a version of your solution actually coincided with Google reindexing my site - I thought for a few minutes that you had wrought some magic, but sadly it was just a coincidence.

Thanks again Dave.

Joe

joe richardson said, on March 28, 2010 2:23 AM:

Hi Dave, I wrote yesterday thanking you for the sitesearch code.

On further testing, I am getting something strange happening.

When I key the word "apricot" (without the quotes) into the search box in page http://www.stokesleypride.org.uk/html/search.shtml in Firefox I correctly get a single hit; when I do the same in Chrome the same happens; when I do the same in IE8 (8.0.6001.18702) I get "Your search - apricot - did not match any documents".

I have cleared the cache in each browser, and the same occurs.

I modified your code a little to remove the option of searching the web, and I should say that it is only yesterday that Google indexed the document which is the target of the search (a large word doc).

I wonder if you have any ideas as to what I have done wrong? I wonder if I have produced bad XHTML which is being interpreted differently by the 3 browsers. When I do a w3c validate I get only warnings, but relating to the / at the end of the input tag.

Regards,

Joe

Regards,

Joe

raj vaghela said, on April 1, 2010 12:44 AM:

thanks this is most important for me for add my site.


Thanks joy

Jack said, on April 14, 2010 1:50 PM:

Hi, I used the same code.
When I use the url http://www.google.com/search then it works fine but when I use my site name in action attribute then it throws an error which is something like
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
please tell me why it is happening.
Thank you for useful article.

John Price said, on April 24, 2010 12:36 PM:

Hi, A Charity I am involved with has a link to a google search engine, http://google.hostuk.org/
Which actually pays them if a visitor used their link!.. Could you please explain how we can obtain one for our Organisation The ABD.. I have spent hours searching but could find Nothing?? Thanks
John :(

Dave Taylor said, on April 24, 2010 11:14 PM:

John, looks like they're playing some games behind the scene and that they're using Google Search within an iframe or similar, something that lets them have standard AdSense ads on the very top line and the Google search results after. Note that there's no copyright or material at the bottom of their search results pages. My guess is that it's actually a violation of the Google Terms of Service, so I wouldn't be surprised if they were shut down at some point.

Ashwani said, on April 25, 2010 12:27 AM:

Hello All,

This is very intresting code...
But when i use this on my website , when anty body search anything from my website , when user click on search button the result shoing on google page.. it is not looks god ..

i dont wnt to go google page search result ..
i want all result shown on my web page ..


Thanks
Ashwani kumar

tham tu said, on April 28, 2010 10:06 AM:

Thanh you very much.
I will add to my site

Tham tu

Jacob said, on April 29, 2010 3:41 PM:

Is there any way to make the results pop up in a hovering window like the Google Custom Search does? Also, I have tried searching my name, witch is on the home page multiple times, and it did not come up with anything. It also does not come up with the names of my pages. It is an HTML website; how can I fix these problems?

Montigny34 said, on April 29, 2010 4:37 PM:

Okay I foudn your website interesting Dave. But like many people have asked, how do I make a "search engine" that searches only my website liek the content of it and stuff like that? You said to people that they needed to install their own search engine? How do I do this? How do I make one? Could you send me links? help? Yes my site is blank, that is because im remaking one from my old one "http://www.ps3-clans.tk" because I prefer my new name. Plz respond A.S.A.P. please thanks

Opara Prince said, on April 30, 2010 7:27 AM:

Thank you!!!! very much for this great clue am so delighted to having come in contact with this site. Again Thank you!!!!!!!!

Mr.Blogger said, on May 1, 2010 12:09 AM:

its really helpfull and fantastic'
Thankz a lot

D.E.M. said, on May 2, 2010 10:27 AM:

Wow. A lot of these questions are almost hostile! Thanks for the FREE advice on how to easily add a search function to a site.

And for the FREE answers to many questions, that you seem to find time to answer....for free.

Nate said, on May 6, 2010 1:31 PM:

Dave, The search works great and thanks for the how to. I am wondering if you can tell me how to get the results to show up on a custom results page on my own site.

Justin T said, on May 6, 2010 7:21 PM:

Hi Dave,
Thank you for the tool it works great on my site. I have but one question and have been exhausted reading the comments.

Is there a way to insert text into the search box as an example, "toronto red camera" but when the user clicks to put text in this would vanish so they can put in their own string without having to delete my example of how to search my site.

Make any sense? and do you know if this is possible and I know its a long shot.

Thanks again you rock!

Justin T said, on May 6, 2010 7:39 PM:

Here's the solution to my question above.

<input type="text" name="q" size="25" maxlength="255" onfocus="this.value=''" type="text" value="example: toronto red camera" />


Works nicely on my site, thanks again for the original code!

hdelpihero said, on May 7, 2010 3:44 AM:

value="bridge.co.uk" checked

I do not want the people to have a option if to have a check box or not, i want by default them to search my site with out showing a check box, can you help with a alternate code please.

biren said, on May 9, 2010 7:00 AM:

my searchbox didnot work properly and this is not a first time. plz sir help me.

Baketi said, on May 14, 2010 1:06 AM:

Dear Dev,

i was looking to place same thing on my website and very happy after this my website become a cool website for hang on by youth. thanks a lot

The-Marshal said, on May 14, 2010 6:35 AM:

Dear Dave

How can make to radio button one search in my site
and other one search in web ...

Regards.

Shakeeb said, on May 18, 2010 7:04 AM:

Hi,

I have followed the steps u hav mentioned above for adding a google search for my "website" on my server, The problem is my website also has the blog i'e www.xyz.com/blog (wordpress),

1. When I enter the keyword its successfully searching the wordpress database but not my website database or the words on my html page, Why so ????????

Thanks,
Shakeeb

dhaval said, on May 18, 2010 11:00 AM:

hi dave, i am 14 yrs old and have made a web enabled software in asp.net. It works for post transaction recording facility of customers. Now the problem is that my clients have asked me to include a search box in the site and i am not able to figure out how to do it. can u please be kind enough to explain me the steps of adding the search box in a site developed in asp.net ??? I would be very grateful..


Regards,
Dhaval Desai.

Chris F said, on May 20, 2010 10:05 AM:

Dave,
Thanks so much for all your help! I have the same wish as Justin T on May 6, 2010. I want to insert text into the search box as an example, "toronto red camera" but when the user clicks to put text in this would vanish so they can put in their own string without having to delete my example of how to search my site. Unfortunately, the code he provides didn't work for me. I'm probably doing something wrong with the onfocus but can you help. Also, is it possible to change the background color of the Google search box from white to another color. Thank You!

George said, on May 23, 2010 2:29 PM:

Hi,
I like the code to search the web site. The problem i have is that I would like the search results to be displayed on a different page called 'results.htm' hosted locally.
what should I do?
Thanks

Jessica said, on May 24, 2010 11:54 PM:

Hi Dave,

I found your website, and it is really helpful for my school project. However, I would like to make the search textbox to be able to search three different websites e.g. Google, Yahoo, and Bing at the same time. Can I possibly do that?

Thanks,
Jessica

G.SUDAN said, on May 28, 2010 3:54 AM:

actually i'm creating a website using frontpage.
the thing is i need to have flash news running in my site . like in some news sites. can this be done. if it can be done then please tell me how to do it please. i have to complete my webpage by comming monday. please help me out with this. how to add news to my website. flash news running in my site everytime

G.SUDAN said, on May 28, 2010 4:01 AM:

Hi Dave.

actually i'm creating a website using frontpage.
the thing is i need to have flash news running in my site . like in some news sites. can this be done. if it can be done then please tell me how to do it please. i have to complete my webpage by comming monday. please help me out with this. how to add news to my website. flash news running in my site everytime.

JEETANDER KUMAR said, on May 29, 2010 12:19 AM:

sir, I HAVE HCL WINDOWS7 LAPTOP,I WANT TO GOOGLE MY SEARCH ENGINE/HOME PAGE.WHEN I COME BACK TO SEARCH OR[AT FIRST SEACH TIME MY SCREEN ALWAYS KEEPS WHITE]PLEASE KEEP HERE GOOGLE SEARCH.

gazetekolik said, on June 3, 2010 5:57 AM:

its really helpfull and fantastic'
Thankz a lot

mohawkmofelix said, on June 8, 2010 2:19 PM:

Thank you so much, worked marvels!
Keep up the wonderful work!

Eli said, on June 11, 2010 7:13 AM:

Thanks Dave! This is pretty cool.

brenda said, on June 11, 2010 12:20 PM:

what is coding free web pages for intanets sites?

I am trying to list a google blog on a vista print website and want a google adsense. Will this work or not?

Thanks for the feedback.

BreKay

Aman said, on June 17, 2010 10:10 AM:

Thanks buddy for the code... thank you so much..

Bradley said, on June 19, 2010 10:51 PM:

Hello Dave.

How could I change the form below to the form for Google Search like yours? Please, I really need assistance with this. I have tried everything to get it just right, by going over your post 1,000 times. Yet, I keep failing. :'(

<form action="#" method="post">
<fieldset>
<legend>Site Search</legend>
<input type="text" value="Search My Website…" onfocus="this.value=(this.value=='Search My Website…')? '' : this.value ;" />
<input type="submit" name="go" id="go" value="Search" />
</fieldset>
</form>

Bradley said, on June 19, 2010 10:53 PM:

Well, it did not show the form. :'(

Bradley said, on June 19, 2010 11:00 PM:

The code didn't work on my last post.

But, your box is too big for the section on my website. How would I fix it to fit that area?

DAVID said, on June 22, 2010 9:46 PM:

How do I get the search box to be in the centre of the page. What tags do i add to your code

joe said, on June 25, 2010 2:25 PM:

Hi Dave, I like a few times above was curious as to moving the search box to the center or right. I am new to html coding and doing my own site for the first time thanks.

منتديات said, on June 26, 2010 5:34 PM:

Hi Dave, I like a few times above was curious as to moving the search box to the center or right. I am new to html coding and doing my own site for the first time thanks.

Dave Taylor said, on June 26, 2010 10:10 PM:

There are a couple of ways you can move the search box, actually. first off, if you want to move the input field and button *inside* the box, then add <center> immediately after the <div> tag and </center> immediately before the </div> tag. If it's the entire box, then put the CENTER tags before the DIV and after the /DIV tags, respectively.

That are more sophisticated ways to layout elements on a page, but I hope that'll get you folks started...

CharlieB said, on June 27, 2010 11:24 AM:

Thanks for the tip and code. I added target="_blank" to so the search results will open in a new window.

Guillaume said, on June 28, 2010 2:03 AM:

Hi thank you so much for all your work it is really helpful.
I have 1 little problem though. in this div =

[div id="checkbox"]
[input class="floatLeft" type="checkbox" name="sitesearch" value="nasituan.org/" checked /]
[p class="floatLeft clearRight">Only search Nasi Tuan[/p][br />]
[/div]

the "/" in the value and "checked" don't validate...

it's not a big issue but if there is a way around it that you know of I would really appreciate it.

Thanks again
Guillaume

Dave Taylor said, on June 28, 2010 7:37 AM:

Not sure about the value= issue -- haven't read the HTML spec recently -- but I can tell you that if you're using the /> notation as I am, you are using XHTML rather than HTML, so make sure that you have specified that in your document header and/or in the validator.

nak said, on July 1, 2010 11:26 AM:

a way to make the code work with subdomain ?

salman said, on July 2, 2010 5:24 AM:

thanks dave now i add this in to my site.

deepak saini said, on July 3, 2010 7:17 PM:

i luv u.....u solve my search problem for about 6 months now i have no problem for search in ma blog....bye and god bless u ...angel

Ammar Alsulaimani said, on July 4, 2010 4:42 PM:

can make custom google search in my database..

Arjen said, on July 7, 2010 6:16 AM:

Dave,

Many, many thanks for this very clean search script. It works like a charm and I appreciate your efforts! Well done, great work!

اعلانات مبوبه said, on July 7, 2010 9:18 AM:

i luv u.....u solve my search problem for about 6 months now i have no problem for search in ma blog....bye and god bless u ...angel

Geoff said, on July 11, 2010 8:52 AM:

Thanks this code works really well on my site. You've helped me solve a problem.

Dave Taylor said, on July 11, 2010 9:12 AM:

Going wayyyy back here, Bradley, the code you list (which I just tweaked so it'd show up, btw) has a huge problem: the "action" attribute to the FORM tag needs to be the URL of the script that is going to get the query and process it. By having it as

action="#"

what you're telling your Web browser is that the current page (e.g., your own page) is going to process the search query, which is, of course, incorrect. Go back to my original code and you'll see that I have a URL that's the Google search back end. Try that!

hamid sayyed said, on July 13, 2010 11:39 AM:

very good script. send me more scripts like this . good work kep it up..........

Angela said, on July 17, 2010 10:21 AM:

Dave

Thank you for your wonderful html code for adding a google search box. I have added this to the Website which I administer.

I have only just started and understand very little HTML code.

The search box is wonderful, but does not clear the search automatically. What other code should I use to clear the box for another search.

priya said, on July 27, 2010 5:57 AM:

hi,,
nice piece of code.. but i find that it works only when i refresh the page once.. else its not working. pls help

konteyner said, on July 27, 2010 1:32 PM:

I have only just started and understand very little HTML code.

steve said, on July 29, 2010 6:01 PM:

Hi Dave - first off, thanks!!

One question...how could I set this so that part of the search phrase was predetermined, with the users entry filling in part of it?

i.e. - The user types in "rules", and the search is done for ["table tennis" "australia" "rules"]?

Maged said, on August 4, 2010 9:44 PM:

thnx for the code i wanna ask if i can make the results appear in my websites not in google is this possible or not

John Rock said, on August 5, 2010 11:49 PM:

thank to giving me right direction.

Fhernkenstein said, on August 5, 2010 11:56 PM:

tnx very much dude,it helps to our computer project.

Roger Lapin said, on August 8, 2010 9:56 AM:

Thanks for the info I have always wondered how people did this - will be trying this out later tonight.

Roger

Goeff said, on August 8, 2010 9:59 AM:

This is great - always wondered how to do it but what if I want to move the search box.

Oh - don't worry i have seen some other comments about this - will try it out and see what happens

Geoff.
UK

ken said, on August 9, 2010 1:10 PM:

Just what I was looking for.

Chris Kayt said, on August 12, 2010 9:48 PM:

Hello! Thanks much for the info. I"m trying at the moment to put in a site search BUT I don't want to include the check box or the radio button. In other words I would like the default search to be my website without having to make the selection for my site or google at large. Is this easy to do. THANKS MUCH!!!

Marcelo said, on August 15, 2010 2:06 PM:

GREAT code! I WAS TRY TO FOUND 3 DAYS, a code like this!!!!!!! thank yu SO MUCH

Pascal said, on August 16, 2010 6:44 AM:

Great code.
But it does not work when I change the name="q" into something else. That is weird.
But I hgave a question :
What change in the code do I need when I would like the 'Google Search' submit button into a nice Google gif or jpg.
Would you be so kind to shower your expertise over me and help me out on this ?
Would be great. Thanks for the script anyway !

Pascal said, on August 16, 2010 2:39 PM:

To replce the submit button by an image, just do :

input type="image" src="picture.gif" name="optional"

instead of

input type="submit" value="Google Search" /

Leo said, on August 17, 2010 11:18 AM:

Hi everyone,
how can I add the query suggestion feature to the Google search box?

thanks!

ashu said, on August 19, 2010 8:08 AM:

sir,here form method="get"..is it possible in "post"
method..pls reply must....

Irena said, on August 20, 2010 8:01 AM:

Thanks, Dave
Your tutorial very easy-to-use for a newbie like myself, so thumbs up!

Amarjs24 said, on August 21, 2010 1:44 AM:

Thanks, Dave
nice article...

Ravi said, on August 24, 2010 6:51 AM:

Hi.Dave i am visiting ur site.its very useful me for google code.and i also use it.its really working good.so i wil be thank for you.I wil be visit next time.

Asiri Gayan said, on August 24, 2010 9:37 PM:

I need to modify my search bar only to view pdf files. please can you say how can I do that?

Liz Purcell said, on August 26, 2010 5:13 PM:

Dave,

Great search box! I recently signed up through Google, but am having great trouble understanding it so far. Yours is so nice and simple.

taj1 said, on August 29, 2010 10:33 PM:

please whow clearly that how to submit url to google id your site is very useful for me i am using your site since last three years and i found all the time it very useful please improve it
i will be very thankful for you for this kindness
please hurry up
Thanks in advanced.
ok by.

Rob said, on August 30, 2010 1:42 PM:

Does this work with a subsite? Like I am currently using a school lab website so for example it might be:

http://lab.school.edu/classroom5/1a/johnsmith/

Being that this is the URL and its not a simple www.name.com will google search this site?

Dylan said, on August 30, 2010 5:43 PM:

hey dave i've added this google code to my website but i dont know how to format it, like move it around my webpage, its currently stuck in one place and i cant move it. do i need to create a div class or what?

Reg Whelan said, on September 3, 2010 5:23 PM:

Hi Dave Taylor,
I'm relatively new to website programming and I wanted to put a Google Search box on one of my sites. I did a quick search and your site came up with all the information and options under the sun in the comments. Good yo see you take an interest in others.
Best Wishes
Reg

Mabry said, on September 7, 2010 7:53 AM:

Greetings!

Your advice is so often spot on...
I have designed a website www.thecozyoaks.com using Microsoft Publisher 2007. There is an option to add a response page which I have done. The site is hosted by Godaddy. I can't figure out how to get the info on the response page back to me nor can I figure out how to activate the "email me" link @ mabrybenson@thecozyoaks.com. BTW godaddy does not know how to do it either...

Mohammad Muaaz said, on September 8, 2010 8:35 PM:

very good

jennifer said, on September 9, 2010 8:40 PM:

Awesome!!! The code worked flawlessly.

mike lesser said, on September 10, 2010 9:36 AM:

Dear Dave,
Thanks for your most lucid advice.
Can you tell me how to get the local Google search to pick up on the text (.txt) files on the site. The OCR text is up on the server but it is invisible at present.

Prakash said, on September 14, 2010 2:46 AM:

Hi Dave,
I need to customise my search engine so that i should fetch and display only 15 links from google.
Are there any methods to implement it..?

Regards,
Prakash

Annie said, on September 17, 2010 8:22 PM:

Hi Dave can you please tell me if the above coding etc for a google search box will work on a flash template?
I want site viewers to be able to type in a www. address from a list on my site that will then appear in a new window.
Many thanks Annie

Surya said, on September 20, 2010 12:15 PM:

Hey Dave, is it possible to make the search box give the suggestions google gives in realtime?

wahyuwin said, on September 23, 2010 1:30 AM:

nice...
very usefull for me...

vitali said, on September 23, 2010 9:05 PM:

I am looking some tech. help to install in my web side search box and propuce same search results using google or any another search eng. Any one from this board wanna joint this project?
If yes please e-mail me. Thank you. Vitali.

Asim Usta said, on September 29, 2010 8:38 AM:

Hi Dave. Great info thanks very much. I really benefited and now a regular of your site. Bless you.

Elia said, on October 7, 2010 7:42 AM:

That is what I need for my site. Thank you!

humniz said, on October 12, 2010 4:42 AM:

thank you so much.......

Mugisha Leonard said, on October 20, 2010 1:38 AM:

This is very helpful..thanks to you Dave. I saw what i wanted.

Justs said, on October 24, 2010 1:00 PM:

thanks for usefull info

Mark said, on October 24, 2010 8:18 PM:

Can you change the text colour to white? My website has a black background. Thanks

Kulvinder Singh said, on October 26, 2010 7:52 AM:

Tell me how can I display the google search results on my website's page.

Ramkumar said, on October 26, 2010 11:15 AM:

HI DAVE.. please tell me how to add search engine to my webpage(website)? I don't need google search page to my website.. Search should be only with in my website.. So Please give me the basic ideas about adding search engine to my website?


Thanks in Advance

Marin said, on November 8, 2010 6:41 AM:

Hi dave, I am having problems with adding "Google text input assistant" to my search..

Please help, thnx

Dave Taylor said, on November 8, 2010 7:49 AM:

Uh oh, not sure what you're talking about, Marin. Are you talking about the auto-complete feature that Google now has on its search box? I think there's a fair amount of JavaScript behind making that work, and it's definitely not code that's included in this simple snippet. If that's what you're talking about, drop me a note and I'll see if I can figure out what's involved. ;-)

Marin said, on November 8, 2010 10:05 AM:

Hi dave, I am having problems with adding "Google text input assistant" to my search..

it is virtual keyeboard which you can open by pressing image inside input tag..

Please help, thnx

Sumit said, on November 9, 2010 8:49 AM:

Hey Dave,
I am incorporating google search on my website. The method that you have suggested directs me google itself for the results. But I want to display results given by Google on my website itself. So can you help with that?

steven said, on November 15, 2010 7:10 PM:

Hi i'm trying to add a code or tag? to my website for an seo trial. but i have no clue how to do so. thanks in advance..

Help said, on November 20, 2010 4:03 AM:

Thanks for this,
I've got everything ready:
- Embedded it within my own site = Yes
- Search pages within my own site = Yes
- Display the results below the Search Box* = No

*Display search results in the same page; no pop-up to the Google Page

Please help, am nearly done :D

Help said, on November 20, 2010 4:09 AM:

Sorry for Double posting,

Quote from: "Sumit"
Hey Dave,
I am incorporating google search on my website. The method that you have suggested directs me google itself for the results. But I want to display results given by Google on my website itself. So can you help with that?

Thats what i mean

Miguel said, on November 26, 2010 7:25 PM:

can i create a site just with google search?
and my website logo on top?

Nicson said, on November 27, 2010 8:26 AM:

Thank you Dave for your posts, they help me a lot.
success !!!

njb said, on November 29, 2010 12:35 PM:

Hi Dave,
Thanks for being such a rich resource for those of us who are not very experienced. My goal is to see all search terms/words that visitors type into the search box, so I can improve my page copy. I have successfully set up the Free Standard Edition of site search, and use an iFrame. I have been to succesful having results shown on a page that I created, when I type in various test phrases and single terms in the search box. So I am halfway to my goal. The problem that I am encountering is that in GA I do not get any results shown in my reports when I go to Site Search (they all show 0). I have edited my profile to make sure track site search is turned on and have "q" in the variable box (I really do not understand this box). I also just added the new analytics tracking code to the top of my pages, as Google recommends, before "". Any help that you could offer to resolve this would be greatly appreciated.
Sincerely,
njb

kalalloo said, on December 5, 2010 7:28 AM:

How do I embed a pandora media player into my website

jada said, on December 11, 2010 4:20 PM:

Hi Dave i have a little problem concerning code that i can use to my website search box, so that if the visitor type the word on the search box he or she can able to get a reply

Thank you
Jada...

Teo said, on December 16, 2010 8:54 AM:

Dave,

I have an embarrasing question.

I have installed your code but it's stuck on the left hand side of the page. How do I align it so that the google search box is in the center of the page? I have spent the last hour trying and nothing is working.

also I created a search results page for my website. How do I go about getting the google search results to appear on my .html page?

Sorry if those two questions have already been answered.

Teo said, on December 16, 2010 9:23 AM:

Dave,

I was able to center my google search box. I saw that you provided an answer to someone else.

How do you make the text box longer in length?

Charles said, on December 17, 2010 12:39 PM:

Dave, You have got to be one of the most patient guy I have ever come across. Thank you.

Benjamin said, on December 20, 2010 1:52 AM:

Hi Dave,

How can I add multiple websites and not just one. I want to tell the search engine to search a specific websites which I listed for my own used. How can I made the code like;-

[[ input type="checkbox" name="sitesearch"
value="askdavetaylor.com+yahoo.com+wiki.com+ebay.com+and so on" checked /]]

Daniel said, on December 21, 2010 3:29 PM:

Thanks. It was so much easier then I thought.

Dan said, on January 3, 2011 12:10 AM:

This list of comments has been alive for 7 years. It could be the longest comments list ever in the history of the web. ;-)

Dan_ said, on January 3, 2011 12:15 AM:

oops. I meant 6 years. i need sleep. ;-)

Benjamin said, on January 3, 2011 6:51 AM:

Hi Dave,

How can I add multiple websites and not just one. I want to tell the search engine to search a specific websites which I listed for my own used. How can I implement this in php?

Cathy Stanford said, on January 4, 2011 2:23 PM:

Your code worked beautifully! I had an old Google search box on the site and just discovered today that it was no longer functioning. Your code worked well and it seems to be able to search beautifully.

Jeff said, on January 8, 2011 2:27 PM:

Hi Dave,
Thanks for the code, it worked like a charm. I've been wanting to do this for some time and your code made it easy. My question is this:
Once I get the search results, and I click on one of them, Google always takes me to the top of the page rather than to the exact location of the searched item. Is there any way to get Google to take me directly to the searched item on the page? My pages can be long and the searched item may be buried in tons of text. As a note, Google does indeed display graphically the found item if I hit the magnifying glass icon on any of the results, but it is too hard to read and I am unable to navigate to the text, but only to the top of the page.
Thanks for your time in following this blog for 6 years!

Syamdersh said, on January 9, 2011 11:57 PM:

I have to integrate my site with google custom search.during this search only return pdf of the records from my site. Tell me about the solution?

Harry Potter said, on January 10, 2011 2:47 PM:

Does you website have to be on Google for it to find it?

bryonz said, on January 11, 2011 10:54 AM:

Dave,

When I put in the code for the Google Search in my website which is currently under development, where on the site page would the Search Field appear? Is there some way I can control the location of the search field on the page? Thank you!!

Vesna VK said, on January 11, 2011 1:49 PM:

Thanks so much for this tutorial and code, Dave!

I didn't want to give readers the option of broadening their search to entire Web. It took me a while, but I figured out that instead of the line about the checkbox, I needed to use this instead:

< input type="hidden" name="sitesearch"
value="askdavetaylor.com" />

I saw other questions about this in this thread, so I thought I'd post the code for anyone else who wants to do that.

Katie said, on January 11, 2011 6:49 PM:

Dave, I managed to get code on my site. It looks real nice, my name is checked but I can't seem to get any searches on my site, just google and the web if I uncheck my name.
Where you write about manipulating the variables, was I suppose to do a step re: that before I pasted in code. If so, I'm lost and not sure how to do that part?
The other problem, might be, that my blog is private. Perhaps that won't enable me and visitors to search my own blog? Hope this does not sound too ludicrous to you as that's what it's starting to sound like to me. Thank you in advance if you can help me.

Katie said, on January 12, 2011 7:01 AM:

Please ignore my post. I got the code to work.

Thank you very much

Katie said, on January 12, 2011 8:08 AM:

Dave, I thought it was working. I won't comment again until you have had time to get back to me.

It will only search the last post of whatever I'm trying to search for. If I try to hit on older posts,it states the same reason as up on top next to the embedded search from blogger that my permission settings make it this way.

Thanks

Tattoo said, on January 12, 2011 8:17 AM:

How can I change the color of the "only search blbla.com" text???

tattoo said, on January 12, 2011 8:52 AM:

Nevermind! Got it! Thanx for this!

Baker said, on January 21, 2011 6:06 AM:

Hi dave am really happy i added the search google tool bar on ma site but next i would like the result searched content to be returned in ma web page thanks

Nate said, on January 31, 2011 11:10 PM:

NM.... I got it. I had a screwed up nesting of and tags. somewhere I had an extra tag without the closing tag.

Thanks for the code. Works Great

mike dorl said, on February 6, 2011 6:34 AM:

my web site is a large set of pages at the UW at domain/user/AAWEB where domain/user is a place holder for where my files are stored. I'd like to add a search for one file there. I tried replacing askdavetaylor.com with domain/user/AAWEB and the name of the file I wished to search domain/user/AAWEB/IDXD.htm. If I type domain/user/AAWEB I do get a directory so it looks like google could know what files reside there. So far it looks like the search is constrained to my site but doesn't find anything. Is it possible to have google search a specific file?

Dave Taylor said, on February 6, 2011 7:44 AM:

Before you try to use the Google search on your own site, it seems to me a good idea to go to Google.com and search for your domain with the notation

site:yourdomain.com

Then look at how many matches there are. For example, I might use "site:askdavetaylor.com" and see how much Google has matched. If it's 11 pages of the thousands I have online, well, then having that search on my site won't be useful.

How do you get Google to see more of your site? One big thing is to ensure that you have a proper sitemap. Google has some good info about it:

http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=156184

Hope that helps people out!

anouthone said, on February 6, 2011 5:07 PM:

HI, I would like to add search to my site that search only for my site return with only my site, ex: my page, my files, link, data and never get out of my site. ?

i will be appreciate for your help.

steven - web design said, on February 6, 2011 5:33 PM:

Very nice and clean code, however to validate as XHTML you'll have to change a bit the final line:

value="askdavetaylor.com" checked="checked" /> only search Ask Dave Taylor

Dany said, on February 10, 2011 12:50 AM:

Nice for that support!Thx.But I still have a problem about how to customize search results to be displayed in my web.I'm using target but not working.

liz said, on February 11, 2011 11:29 AM:

When I paste the code into my site, the search box appears but if I enter a search and click, nothing happens- a new page won't open and the search goes nowhere. Help!

Thanks.

liz said, on February 11, 2011 1:06 PM:

To expand after further reading your previous answers:
When I paste the code into my site, the search box appears but if I enter a search and click, nothing happens- a new page won't open and the search goes nowhere.
The site is indexed and gets tons of results when I do the site:auroracollege.com (or nt.ca- both work) search.
I tried on different pages and it does the same thing.
The site apparently used to have a google search button but it got deleted.

Thanks.

Dave Taylor said, on February 11, 2011 2:50 PM:

Liz, can you share a URL of a page where you have added the code so I can have a quick peek? Thanks!

liz said, on February 11, 2011 11:48 PM:

Thanks, Dave.

It's www.auroracollege.nt.ca

or www.auroracollege.com (both go to the site)

ashish said, on February 17, 2011 3:12 PM:

i want to implement search option and want the result on the same website page. who it is possible becasue when i have implement it is showing result on google page. please help. thanks

Trevor Clibery said, on February 19, 2011 1:55 PM:

Thanks, Dave. Works nicely.

Eric said, on February 21, 2011 7:55 AM:

If I were to add Google search to my website, does it search just the published content or can I get it to search any databases attached to the website as well?

Gautam said, on February 24, 2011 11:23 PM:

Hey Dave,
First off, I don't have any knowledge of HTML, PHP, XML, etc. I want to put up a custom google search engine on my site that shows the results on my website itself. The trick is, I want to add a filetype:pdf, or ppt, or doc, at the end of the search query(by default), and use them on different pages to create a custom google file search right on my site. You get the hang of it right? I'm using Webs.com so I can add the HTML as a widget on the pages. Please help me with the code. Hoping for a reply soon.
TC

DJ Jaffe said, on February 26, 2011 1:26 PM:

Hey, while you're having that coffee I just bought you, I have a question (grin)....On your code to add a search engine box, I want the box to ONLY search my site., i.e, I don't want, need the radio button. I tried and tried but couldn't figure how to eliminate it.
Thanks for your site...from one do-gooder to another.

Dan said, on February 28, 2011 7:03 PM:

Is there a way to return the first 5 results from google without leaving your page. If so, can you post the code :) Thanks.

Sally said, on March 1, 2011 6:51 PM:

Worked really well for us. Thanks for taking the time to help out. Sally

Henry Armitage said, on March 4, 2011 11:32 AM:

This is tremendously useful and you are a tremendously useful person for posting it. Thank you so much. :D

Riju said, on March 5, 2011 9:32 AM:

thanks dave..

baruk said, on March 8, 2011 3:01 PM:

big heap thanks dave. and again!

Mateen Yousuf said, on March 10, 2011 7:29 AM:

Dave
i have a new website www.islamchest.com. i have a 6 month old domain being used in it but i rejected once by google adsense say before 3 months. i have more than 100 unique visitors daily and will increase to thousands in coming months. Check the site n tell me how can i seo it furter and will google adsense accept me now.

Z_Man said, on March 14, 2011 2:06 AM:

Dave, when I put the Google search code on the Master Page it redirects me to the google site but with no search results. However, if i use a page that does not use the Master page it works properly. Can you please advice? Thank you.

Tammy said, on March 14, 2011 7:07 AM:

Hi Dave,
It looks like you're still answering. I have used this code for a few years now and it has worked perfectly. Thanks so much! I have an existing site, but am upgrading from tables to CSS, new template, etc. I have a search box image that goes with my site.
My question is...When I put something in the value="" command (value="math"), I get results for math on my site. If I type in "science", it searches science on my site. As it is right now (blank), it goes to the Google homepage.

Here is my partial code:

input type="hidden" name="q" size="25" maxlength="255" value=""
(this of course, has the opening/closing brackets, this posting box keeps wiping them out.)

I hope this makes sense. Can you or someone here please tell me what I am doing wrong?
Thanks for your help.
Tammy

Nic said, on March 14, 2011 9:42 AM:

An answer to a questio that was asked in 2006 became useful to me in 2011. please Dave dont delete old posts

Tammy said, on March 14, 2011 7:04 PM:

Hi,
I found the problem. I created a white box to replace Google’s box. I had to get my image in the right spot. Also, I had the input type as hidden instead of text. My code works fine now, even with my own search box and submit image. I wanted it to search for terms in my site only, through Google. For everyone trying to do this same thing and as new as I am at this:

Here is my HTML code (opening/closing brackets removed so it would post on here):

form method="get" action="http://www.google.com/search" id="form"
input type="text" name="q" size="15" id="white_box" class="search" maxlength="255" value="" src="images/white_box.gif"
input type="hidden" name="sitesearch" value="yoursite.com"
input name="submit" type="image" class="submit" value="Submit" src="images/go_but.gif"

I hope this helps someone. Thanks to everyone that posted on here. I learned something!

edelyn cabalhin said, on March 15, 2011 4:48 PM:

Perfect! It is really great to have a google search box on my site. I can no longer as for more. Thanks and please keep me posted for some updates on this. :)

Karan Kapoor said, on March 18, 2011 12:40 AM:

Hi! Dave please tell me ,how we can link application softwares like ms paint in html sites

martin said, on March 18, 2011 1:49 PM:

Hi,

At the side of my website i had my address, phone number etc. for some reason these have gone, can you shine any light on this issue for me as i am at a loss,
thanks,
martin

Jason Anderson said, on March 19, 2011 1:38 AM:

Very helpful! Thank you! I even managed to adjust the size without screwing up my website! Thanks!

Akhtar said, on March 23, 2011 10:14 AM:

How can i display the search results(from the above code) on to my own(self designed) page, while as the above code redirects us to the google's page and then results are displayed there.

thanks

Andrey said, on March 24, 2011 4:31 AM:

It is certainly a wonderful way to add search function to the site, but how Google itself (with its "Google custom search" http://www.google.com/cse/ ) will treat sites with this kind of unofficial use of google search engine ?
I mean - using "Google custom search" your site suppose to become a board for google contextual advertising and in the way that you propose google would not have any profit.

Thank you

Andrey said, on March 24, 2011 4:39 AM:

I just wants to know - is there is any risk in use of this google searchbox for free, while google selling this function.

Andrey said, on March 24, 2011 4:42 AM:

One more thing - previous question was applied for the commercial site

Tammy said, on March 24, 2011 8:58 AM:

As I said, I am new at this so, if there is something wrong with my code (illegally), please let me know. Dave or someone who knows absolutely for sure?

aroma said, on March 29, 2011 6:44 AM:

hi dave how would i change the position of the search bar for example mine is appearing on the top left and i would like it on the top right

gameruler said, on April 1, 2011 2:20 PM:

I'll try this soon. thanks

magnus said, on April 1, 2011 6:26 PM:

I design a website. it centred well when you browse with internet explorer, but with firefox it is left aligned. i do i make it centre in firefos as well. also the scsript work well with I.E. but not with firefox

BillieKate said, on April 2, 2011 12:42 AM:

Thanks Dave. You are a genius, but I am sure others have already told you this. Keep up the good work. It is much appreciated.

Shah Riaz said, on April 6, 2011 11:41 PM:

Hi,

Your goggle search Code is very excellent work.Thank u so much.It`s very helpful me.

Rat said, on April 9, 2011 4:44 AM:

Hey Dave,

Good stuff. Is this method legal to use on any site?

-Rat

one said, on April 11, 2011 11:52 AM:

my website is in hebrew (windows-1255), and whenever I use the code, google gives me weird characters instead of hebrew.
tried to add

all I get now is question marks.

how do I get it to work?

one said, on April 11, 2011 11:55 AM:

that code that isn't displayed is
INPUT TYPE="hidden" name=ie value="utf-8"
input type="hidden" name=oe value="UTF-8"

David said, on April 13, 2011 9:45 PM:

Hey Dave, or anyone else that might be able to help. I currently have google's Custom search engine on my site. As you know, it doesn't allow you to search images. I have created an undefined list that links to google images on the same page of my search results. When the user clicks on the link it does take them to google images but they have to retype what they were searching for. Is there a way to make it so that when the user clicks images on the results page it links them to google images with the search term already submitted?

John said, on April 15, 2011 3:50 PM:

How can I minimise the box so the check box isn't shown?

saman said, on April 21, 2011 11:22 AM:

thanks.thanks

Scott said, on April 24, 2011 9:32 AM:

Hey Dave,

My Google search bar works perfectly in Internet Explorer 8, but in IE9 the toolbar gets pushed way off to the right and only half of it displays. I tried aligning left and other tricks, but nothing works. Any ideas?

Krishnamoorthy said, on April 28, 2011 4:01 AM:

I need to pass the image keyword to google and after that I need to get the image result im my page. Not in google page

Rak Amagra said, on May 5, 2011 6:40 AM:

I treid to pass on the image keyword to google but somehow i dont get result in image google search. For the toolbar i use IE 8 i had trouble with the IE9 and Firefox.

Sharon W said, on May 5, 2011 8:47 AM:

Thanks Dave, it work like a charm.

Shay said, on May 5, 2011 10:55 PM:

Thanks Dave, just what I needed, it works beautifully.

wasm said, on May 8, 2011 11:33 AM:

mmm i have a question , i didn't understand what you mention , i want you to write it step by step .From the first step to the end because i'm an novice and i don't know how to do it ><

gk said, on May 16, 2011 5:25 AM:

Hi Dave ,

I have similar kind of question.

1- i want to load google results in my website without even moving away from my webpage.

2 after the google results if some one click on that results it should not move to other page i wan it to load in the same page ..

eg.

step 1 am in xyz.com
step 2 i entered some keywords in search box
step 3 google search results should load in xyz.com itself
step 4 some one clicks google results page it should load in xyz.com
by this way user stay in my page it self even after he view wat ever he want..

header should always remain same ie xyz.com but results from google ...

pls give with code example..

ramasamy k said, on May 16, 2011 6:08 AM:

Is there any way to display google search result in my web page and the link if it is clicked it should not go out of my site.

kapil said, on May 21, 2011 4:20 AM:

hi dave taylor,,
i am the owner of coolguruji.com and i want to add google auto suggestion in my search box, is there any way to add google auto complete ( for web search)in a search box,
plz help me..
thanks in advance.

Puma at Best Photos said, on May 22, 2011 1:07 AM:

Thanks for the tip Dave! I have been thinking about it for a while and now I can follow your instructions to set it up.

Reodd said, on May 23, 2011 3:54 AM:

Dave
Many thanks for your clear and concice guides, but I was wondering if you knew of a way to amend/adjust the actual google site search provided by Google Free....It is a great tool but as always I need to do a couple of litle tweeks, namely I want to remove the little cross "clear results" from the presented search box....Any Ideas.

Michael Jetter said, on May 25, 2011 9:02 AM:

thanks Dave for your topic, it really avoids me useless web researches which, i am sure, would have led me to a dead end

David Greensmith said, on May 25, 2011 9:10 AM:

This is just what I was looking for! Seems pretty simple, I will give it a go!

Many Thanks

Syamdersh said, on May 25, 2011 10:55 PM:

Thanks Dave But how can i show the search results in various formats rather than the usual way

jefe said, on May 30, 2011 4:25 AM:

Good information thanks for posting.

Awais said, on June 1, 2011 7:58 AM:

Thanks for nice info... i can add now google box

T. Verkauf said, on June 8, 2011 5:40 AM:

i added the google box already and it works perfectly thx for that :)

Clyde said, on June 20, 2011 2:38 PM:

Hi Dave,
I wanted this for a site search. I copied the code, but where do I put it? I tried putting it at the end of the custom.css file, but couldn't see that anything happened. I entered in my home page, but that didn't work right either. I use thesis 1.8
How could it get it to work in the sidebar?
Sorry, I am such a newbie. :(

Clyde

Dave Taylor said, on June 20, 2011 11:07 PM:

Clyde, you need to cut and paste the HTML code *exactly as shown* into an HTML page. Adding it to your CSS definitely doesn't work (as you have learned). If you're running Wordpress, you should be able to paste it into your template...

Arpit Chopra said, on June 22, 2011 6:10 AM:

Thanks for your Search Query
I really very happy to complete my website.

Emmie said, on June 24, 2011 7:06 AM:

Thank you Dave, popped this on my site and works a treat! Simple and actually works.
Much appreciated, thanks

Mike said, on June 27, 2011 10:51 AM:

Hi Dave, brilliant, simple and easy to implement.

Thanks for the headsup on this.

Mike

Jason said, on June 29, 2011 9:22 PM:

Thanks, searched for how to add Google to my site, and Google let me down, in that it didn't pop up a google.com link explaining how to, but your site was on the listings, and it worked.

irfan said, on July 5, 2011 7:44 AM:

1-how can i add videos on my web site? 2-how can i search my web site on google

Nadeeja said, on July 6, 2011 5:31 AM:

Dear Dave
Really appreciate if you could tell me why the Google search code that worked all this long gives an error message "We are sorry your computer network is giving automated queries"
Best
Nadeeja

Gcampton said, on July 9, 2011 8:38 AM:

Holy cow, so many silly questions. This is why I do not provide info on how to do stuff. I was considering doing programming tutorials on my programming forums but thankfully I thought twice about it.
I'm guessing that for the last 5 years you have been answering these dumb questions you probably have less than 1% actually pay you (donate) for your help too :(

Well, if I was rich I'd donate just cause' I feel sorry for ya.
Thanks for the code.

And for all you useless people who don't actually know how to use google, yet you want a google search bar.... try going to "google.com" and typing "how can google see my site?"

First 4 links you get are relevant webmaster links to google.com where everything is explained.

5th link is dave's.

...and if your reading this do the right thing and donate money if you want to waste his time. He's been answering your same dumbass questions time and time again for the last 5-6 years.

Oh and before someone all high and mighty says "oh yeah well your here too" go google "object oriented programming and code reuse"
No point writing your own when there's tons free online. I save writing my own code and using my brain for actual games programming, rather than simple html scripts, and code snipets.

Thanks again mate, and goodluck.

Oliver said, on July 9, 2011 11:09 AM:

I just discover your web site today... It´s amazing
I have put your search script on my website and it is working perfectly.

Only one question: is it possible to hide the check box and its text?

Bristol said, on July 9, 2011 3:09 PM:

Dave, just what I was searching for and it runs a treat! As always, many many thanks.

Zahid \ said, on July 10, 2011 12:30 AM:

Thanks for this code

ameerali badeghar said, on July 10, 2011 3:59 AM:

i want web url

konteyner said, on July 12, 2011 8:47 AM:

Vanuatu has been inhabited for centuries and these species are known to the locals. These are not "new species" at all, they are simply species that european paradigm trained so-called scientists had not seen before.

izrada said, on July 14, 2011 4:51 PM:

Great tutorial, simple and precise. Thanks for sharing

Frank Amristar said, on July 14, 2011 5:41 PM:

Adding the google serch box to the web site, save lots of time for search,Thanks Dave

Mandi said, on July 16, 2011 12:36 PM:

hey, so i'm using a table and some iframes. i used this code and it's working great... but could i use a target tag like you were saying earlier and have the search pop up in the iframe where everything else is linked? i tried doing that, but its not working... any suggestions?

Mikael said, on July 19, 2011 3:10 AM:

Hi Dave

I have a question regarding whether or not it is possible to limit the search of the Google-search-box.

I.e.: if I type "42" into the search box I only want results from a specific subpage and all its subpages.
E.g.:
www.mainpage.com/subpage
www.mainpage.com/subpage/subsubpage
www.mainpage.com/subpage/subsubpage/another_subpage/etc...
(I don't want any search results from mainpage.com/... apart from "subpage" of course)

If this is not possible do you know if it is possible with this solution: http://subpage.mainpage.com?

Any ideas?

Achyut Neupane said, on July 20, 2011 2:07 AM:

hello!!!
how can i add a search box of my site.

Kimm said, on July 28, 2011 1:15 PM:

Works Perfectly!

Vhambee said, on August 3, 2011 6:51 AM:

Hi Dave! After searching for a google search box in the web, i came across the google custom search, but when i used the code, i wasn't satisfied! So i did a search again & found your site which i was skeptical at first, but after trying it, OMG! it works perfectly just as i wanted it to be! & since i want to modify it, i would like to ask you some questions, but after reading all these comments, i guess all my questions are answered!! What else can i say....... but a big THANK YOU!!!

BigVern said, on August 3, 2011 10:40 AM:

Hi. Firstly Dave thanks for posting this great bit of code.

One question I have. Having looked at the Google java based code for adding search to a site, is it possible to link the search code you have put above with an adsense account in the same way... i.e. to earn revenue from people using the search box, clicking ads etc?

Bigvern said, on August 3, 2011 10:40 AM:

Hi. Firstly Dave thanks for posting this great bit of code.

One question I have. Having looked at the Google java based code for adding search to a site, is it possible to link the search code you have put above with an adsense account in the same way... i.e. to earn revenue from peopole using the search box, clicking ads etc?

Dave Taylor said, on August 3, 2011 5:07 PM:

BigVern, yes, if you log in to your AdSense account, you'll find that Google has a search system designed to hook into your AdSense account. I haven't tried it (I use http://www.lijit.com/ here instead) but it's pretty straightforward...

web-ed said, on August 3, 2011 6:19 PM:

Thanks Dave - it worked like a charm!

Abdul Degri said, on August 10, 2011 10:38 AM:

please guyz, help out. how can i add html on google account? please help me out

Opher said, on August 10, 2011 12:30 PM:

hi dave - thanks for this great code.

question/problem - i used the search code for a while and it works great (the code was placed at the website's "header" section). recently, i've added a "contact" feature which also use a method and when it's placed at a lower "section/content" part of the page, that 2nd form always execute the "search" function rather than the "contact" function - does it make sense what i'm trying to say?

here is the 1st / search command

form method="get" action="http://www.google.com/search" target="_blank"

and here is the 2nd / contact command

form name="contactformlite" method="post" action="lite_process.php" onSubmit="return validate.check(this)"

which end up executing the 1st / search function rather than its own.

is there a way to make each command executing its own function?

thanks for your help...

Opher said, on August 10, 2011 1:03 PM:


just figured out the answer: put the following between the 2 form lines -

FORM ACTION=""
INPUT TYPE=RESET
INPUT TYPE=SUBMIT
/FORM

johnbenedict said, on August 11, 2011 11:16 PM:

ahhm.. can i ask a question? is it the same code if i'm creating a site like wikipedia? thanks.

Dea said, on August 14, 2011 11:36 PM:

Thanks man! The search box works. I have successfully added it to my website. Again, thank you

Patrick said, on August 16, 2011 3:18 PM:

Thanks Dave!
This has really helped me out. Especially the "_blank" bit when you responded to John Kiester about opening search results in a new window.

I was wondering if the code could be edited to show search results in a new (non google hosted) same site page.

Say I have the search field on my home page (sample.com) and want the results to appear on my search page (sample.com/results) instead of a google hosted page. Is this a possibility?

If so, please let me know what code to add/revise to accomplish this. THX

Pak Youngers said, on September 2, 2011 1:11 PM:

I use and customize too much.
Thanks : )

Can you tell me anything that search the entire web but shows results within my webpage?

Baljeet Singh said, on September 3, 2011 12:40 AM:

It's very important for me. I don't understand what is the meaning of "q" in the google search code.

and also what is the difference between "id" and "class"? Both seems alike to me.

Please Dave, I need ur help!!

Dave Taylor said, on September 3, 2011 7:15 AM:

Baljeet, the 'q' is the name of the variable sent to the Google search server that contains the value of the search term. In other words, if I search for "chicken", then the variable 'q' will have the value "chicken", as in:

q=chicken

In terms of ID and CLASS, those are to do with Cascading Style Sheets (CSS) and are a different topic entirely. Lots of stuff online explaining the difference between the two if you look.

Chris said, on September 4, 2011 10:30 AM:

It works great, thank you Dave ;)

However, it would be grand if the search results popped up in my own blog instead of google page.

I've been reading for the last 5 hours on all kinds of info and guides and tutorials on how to setup your own search box. I have a blog and didn't like the navbar so I have it hidden.

Tried a lot of html boxes and they work, but they only show the newest posts. If the post is a month old the search box won't find it.

Yours however does xD

Now, if there was a way to make the results appear on my blog instead of Google, then I'd be a happy puppy :P

p.s The search box blogger widget from google doesn't work at all either, I get 0 results everytime I use it

Baljeet Singh said, on September 4, 2011 12:12 PM:

Thank You very very much Dave........
But why "q"?
I tried different characters and words and it didn't work.
So, I think it is necessary to take the character "q". But it represents what....

Hiren jadav said, on September 5, 2011 8:32 AM:

Hi dave
Your job is very nice & don't stop it . If u show code of any website just type address on mobile"server:source" & if u show code of any website just go to view source code.

dil lama said, on September 7, 2011 9:22 PM:

I want to see my web site first page in the google.

dil lama said, on September 7, 2011 9:26 PM:

Hi Dave,

I want see my web site first page in the google of all over the world. please help me and show my web site for everybody first page in the google.
thank you

resim said, on September 8, 2011 3:58 AM:

Thanks you very much, wonderful!

Garry Mirken said, on September 8, 2011 1:37 PM:

Thank you Dave, it works perfect :) Garry.

Baljeet Singh said, on September 10, 2011 10:25 AM:

Hello Dave....
Can u please help me with the code to load a website from the server every time it loads, without being loaded from the cache memory.....
Please help me Dave!!

Will Carter said, on September 13, 2011 12:10 PM:

I will be putting a search box on our website soon - thanks alot Dave

Duncan said, on September 14, 2011 6:34 AM:

Hello, is there a way of making the results appear on a results page in my own site, in a place of my choosing?!

Thanks!

tanay said, on September 14, 2011 7:24 AM:

Hello dave,a great post! By the way I wanted to ask you that:

I want to incorporate a search engine in my website, but I want the search results from the specific websites predefined in my database.How can that be done ?

http://www.ncbi.nlm.nih.gov/pubmed/

Check the above link..I want to create a search on similar lines. Please help me..

m.saqib said, on September 25, 2011 1:49 AM:

thnks 4 this act but this search box appear on left side i want it appear on right, have you any html code??

kalpana said, on September 28, 2011 11:20 AM:

THANKS DAVE for your valuable answers.Here is my question.
I want to display the first five page links which are searched by the google...
plzzzzz do answer for this question and give me html code..atleast idea...plzz plzz plzzz

Umashankar said, on September 30, 2011 9:10 AM:

thanx for the tip

Sheila said, on October 1, 2011 12:13 AM:

Hi Dave,

I notice when searching your site that your picture appears beside each result - how can we do the same thing?

Thanks!

Sheila

Dave Taylor said, on October 1, 2011 12:37 AM:
kevin said, on October 2, 2011 5:37 PM:

Dave,
I am a HS teacher and creating a web site. I have a file cabinet page and would like to create a folder within a folder and can not do it. Is there a way?
Also when i create a page my google site does not give me dashboard as an option. WHy is that?

kevin

shahab uddin said, on October 3, 2011 9:03 AM:

Thank you very much for your kind information.

Sheila said, on October 3, 2011 3:23 PM:

Thanks Dave, I appreciate your responding so quickly.
Sheila

Jan said, on October 18, 2011 12:51 PM:

The site is written in frames, can't change that unfortunatly af i'm not the only one working on the site. But here's my question:
How kan I make the results apear in a different frame? I can make it word opening the results in a new window but in an other frame, is gives a blank page.

Dave Taylor said, on October 18, 2011 8:30 PM:

The trick, Jan, is to give each frame its own unique name, then you can use "target=name" to point the results of a click to a specific pane of the design. Make sense?

Seema said, on October 19, 2011 8:55 AM:

Thanks for suggestion.........i want to add google search in my home page........plz provide me help.........

Cody Wahl said, on October 20, 2011 8:45 AM:

Hi, I'm a high school student in a Web Design class and my assignment was to try to figure out how to put a search bar that searches only our high school web page which we are redesigning as a group. Me and my teacher are learning as we go because we are always trying out new elements. I'm a novice so i'm doing a lot of research to try and get one that works but information is hard to find that i can actually use because i only know html and css. I tried using your code from above but when i tried using a keyword i couldn't figure out how to get the search to recognize the page. i need a lot of help! I really would appreciate your help, thanks for your time

Abe Ekbatani said, on October 20, 2011 3:26 PM:

Hello Dave.
I happened to find this post when I was googling around.
I was tempted to read it because I was familiar with your site;
it is included as a useful source on my site (http://webcreationtips.com/links.html).

A nice article, and plenty of comments.
It seems you have got a lot of fans here.

I would like to make a point about your 'Search Box'.
I don't know if someone else has already mentioned it here;
I didn't time to go through all comments.
According to the strict rules of XHTML, the "checked" attribute has to be declared as follow:
..... checked="checked" ....

Otherwise, the code won't pass 'W3C Markup Validation' test.
I have made a similar box model to yours on my site, but used a 'division' instead of a table.

Cheers.
/Abe

Winston Ferguson said, on October 23, 2011 12:35 PM:

I want to join this plus other websites and I would like to use the same email addressandpassword for a
L

bob-lohana said, on October 25, 2011 4:26 PM:

Dave... Please man just put a simple code in your blog here for people who just want a simple code for just the search box and the button. Not much to ask huh? Thanks big guy appreciate it much.

Alexander said, on November 2, 2011 4:06 AM:

I recently got sick and tired of all the constant changes on my Google homepage. I like a nearly blank page to start with when I start surfing, because every site is trying to distract you with nonsense mostly. Now Google is constantly putting up new suggestions to try this and that, so I created my own home page with the simple search box you provided and I modified the links down to three: web, images and maps. What a beautiful and relaxing page (with my own background image) and no clutter! Thank you thank you, you're a life saver.

Courtney said, on November 2, 2011 7:57 AM:

I tried using this code and it looks fine in iweb but when I load it to the internet it's shows up as a hit counter that I used to have on the page. Any suggestions on how to fix?

David Oriol said, on November 4, 2011 1:17 PM:

Thank very much for your info

Tony McGurk said, on November 11, 2011 4:25 AM:

Hi Dave. Thanks for this tip on making a search box that ACTUALLY works well on Blogger. I have tried a number of different ones that didn't work or worked poorly. Sending the search for my site only to Google search is a fantastic way of doing it. Once again Thanks Heaps!!!

Sara said, on November 21, 2011 5:14 AM:

Hey Dave! Thank you so much for this, it is awesome!

I just wonder if you can make a search box that ONLY search on my website? With no check box or radio botton?

Thank you, again!

Paul O'Connor said, on November 21, 2011 8:06 AM:

Thanks Dave
You are a star..simple info and explained well
Cheers
Paul

Jerry said, on November 22, 2011 6:34 PM:

is there any way i can put the code into my own search box i did?, if so please help

Nizam Khan said, on November 25, 2011 12:05 PM:

Awesome share !

suraj Vitekar said, on November 30, 2011 8:12 PM:

dude,
really looooooooooooong time passed for posting this article.......
7 years....ha.....

:)

Adakoo said, on December 1, 2011 9:33 PM:

i like it you post thank you very much

Martyn James said, on December 9, 2011 9:28 AM:

Hi there Dave
First of all may I say many thanks for a brilliant site, especially about about using the google search.
I have one little niggle that you may be able to help with (well I have another actually but am seeing a doctor about that one!) When I have put in what is being searched for and get the results (opens in a new page) when I go back to the main page the search words are still there. The question is "Is there a way of automatically clearing the box ready for the next one?"
TIA
Martyn

Atia said, on December 10, 2011 12:14 AM:

Hey! Dave I want that on clicking 'about me' the link directs the viewer to a page suggested by me.How could it be possible? Please reply me soon.

Paul Hampton said, on December 12, 2011 7:49 AM:

Very helpful. I was getting a blank page because (I think) my site is using frames. I added the suggested line: target= "_blank" and all was good again.

Tom said, on December 18, 2011 8:12 AM:

Hi Dave,

Is there such a thing as a Latest Google Search Results Box that displays results for a pre-determined search string, i.e. U2?

A new search would be done and the results refreshed whenever the page reloads and contain, say, 10 results.

Thanks,

Tom

Richard said, on December 19, 2011 3:35 PM:

Is there a way to make it so that you do not need check box and that it will only search your site?
What is the difference between this and google's sitesearch program. When I fill theirs out it looks the same then it says there is a yearly charge on the last page. Thx

Anirban said, on December 26, 2011 9:25 AM:

Hey Dave!!!! Thanks for the code. It really works..

surya said, on January 1, 2012 10:48 PM:

hi Dave,
I am doing my post graduation in India.My project domain is web mining.I have some doubts regarding coding...
1.I should design a web search engine that should display the google results in my web site itself.
2.Along with the google results i should be able to show my query recommendations when the user clicks a link.
3.The most important is that my recommendations along with user query should be again fed into the google search engine and the results should be displayed to the user.

What i have done is:
1.I have created a search engine.After the query is given it is getting redirected to the google search engine.
2.I have used an algorithm for providing query recommendations.I just want to be displayed in a separate web page when a user clicks through a link.Please do help me...
Thanks in advance...

Martin said, on January 2, 2012 4:51 AM:

Hi Dave
I am trying to customise a web host search box for my website, the facility works well, but the look does not! (hence why I haven’t uploaded to the site yet)

[form action="http://www.bellewaarde1915.co.uk/search/ksearch.cgi" method="get" name="search"]
[p align="center"][input type="text" size='15' name="terms" value="" onFocus="select(this);"/]
[input type="submit" value="Search"/][/p]
[/form]

Every time I try and change things I mess it up so that it doesn’t work.
What I want to do is colour the border #cc9933, change the background to #4b3e11.
The page that the results populate has been set so that the background colour matches the form and I have set all font colours to render #cc9933, however, only some do this, others are the standard colours of links.
I would appreciate any help at all.

srinivas said, on January 10, 2012 3:03 AM:

Hi, I Installed Google search in my website landing page , i want to display search result in searchresult.hmtl

please send in detail

Swati said, on January 12, 2012 6:18 AM:

Hi

I was just juggling around with adding the google custom search + adsense code on my site and I found your post. Now, I tried both the adsense code and your code for search results and found that your code gives better results as compared to the adsense. Is there any way of combining yours and adsense code so that ads revenue is earned as well as I get better results on my search queries. Also, is adsense not giving good results because of its need to crawl the site thoroughly??? I have a new adsense account so I don't think it has crawled my site entirely. What's your advise?

Thanks

selvan said, on January 16, 2012 2:37 PM:

Hi and thanks. I've been trying all sorts of ways to do the below and can't, could you please help, thanks.

The string below will search for The Beatles, as an example. I want a search box so the user only has to enter the artist they are searching for:

https://www.google.com/search?q=-inurl%3Ahtm+-inurl%3Ahtml+intitle%3A%22index+of%22+mp3+%22The+Beatles%22

anil said, on January 18, 2012 11:37 PM:

hi dave ..

I embedded the site search code
it works fine ..
thanks..

Egypt said, on January 20, 2012 9:38 AM:

The best way is to use Google Custom Search !

Chelsea said, on January 21, 2012 9:14 PM:

Hi Dave,

First of all, thank you for your help. If you'll look at the Web site I've attached (still working on it), you'll be able to see the search bar I'm working with. It is part of the design so all I was trying to do was set it up to actually WORK and it does with your help, BUT since adding the value="iwarmbars.com" so it only does a site search, it actually adds those words over the design (I know, I know, this is purely superficial). Is there any way to make that hidden?

Thanks in advance!
Chelsea

chelsea said, on January 21, 2012 9:18 PM:

Additional note:

If I do "input type=hidden" it removes the words AND the magnifying glass icon (still able to search). It's not crucial, I suppose, but I'd also like to have the magnifying glass icon. Is it possible that I will have to tinker around in the css and/or js files or is there a simple solution?

Thanks again!
Chelsea

Timothy benton said, on January 22, 2012 9:14 AM:

DAVE,
How do I change the font color of the "Only search dave taylor" in your code?

Thanks.

Tim

Dave Taylor said, on January 22, 2012 3:17 PM:

Chelsea, it is indeed possible that you'll end up messing around with CSS. There's a CSS attribute called "crosshair", as described here: http://www.w3schools.com/cssref/pr_class_cursor.asp

Tim, what you seek is really easy because the words "only search Ask Dave Taylor" isn't part of any form tag. So leave the <input> as is, but wrap the "only search..." element with something like this:

<span style="color:green; font-weight:bold;">only search Ask Dave Taylor</span>

Should be straightforward!

Chelsea said, on January 24, 2012 9:05 AM:

Dave,

I figured out an alternate solution of hiding both the magnifying glass icon and the words. Now my final problem is that it is not doing a full site search.

I set the sitesearch to "iwarmbars.com" and it is only searching the index page, not additional pages connected to the site (/faq, /contact, /about, etc.).

Did I miss something?

Thanks again!
Chelsea

Larry Woods said, on January 25, 2012 9:56 AM:

If I have a website named PetShopsInSanDiego.com, for instance, and when someone visited my site they would see a Google Search showing the Pet Shops only in San Diego without them typing anything into a Search Box; how would I do that?
I've been searching for code to do that with no results and I ran across your site, hoping for some insight - or code. Any help would be appreciated.

Dave Taylor said, on January 26, 2012 7:54 AM:

Larry, I don't really understand. If you're going to have a page that just shows search results, why wouldn't people just go to Google and get the results straight from the source?

javi said, on January 30, 2012 3:22 PM:

Hi there, Dave,

I used your google search box, with some modifications and noticed that the check box is on by default and when searching my page it cannot find pages with in my main page. Any suggestions?

Cheers!

Javi

vaibhavdev said, on January 31, 2012 9:45 PM:

Sir is thier any way top get the reults in my web page only is their any way to migrate the results into my webpage

Site is here:-
http://www.clannersarena.com

Sir please help me as i am very much in need of this information.............
Vaibhav dev

Mantosh said, on February 1, 2012 8:50 AM:

Hi Dave,
How can i open top 5 searches in new window when i click **Google Search** from my website.

Dave said, on February 3, 2012 1:33 AM:

Hi, what I'd like is to add a specific phrase to searches. So if viewer types 'Washington' the search results are for 'Washington "Pet Supplies"'. Likewise, if the viewer types 'Boston', the results are for 'Boston "Pet Supplies"'.

I'd be really grateful for any guidance on how to do this. Thanks

Kieran said, on February 4, 2012 6:46 PM:

Hi, I've created acustom search engine in Google to look up websites that I want in it, I copied the code they gave me and put it onto a website called RM Platform, it worked for one area of the site, but I can't make it work in any other page. The code is as follows:

Loading


google.load('search', '1', {language : 'en', style : google.loader.themes.ESPRESSO});
google.setOnLoadCallback(function() {
var customSearchOptions = {};
var customSearchControl = new google.search.CustomSearchControl(
'006699539649831328642:kkdv_pqcshw', customSearchOptions);
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
customSearchControl.draw('cse');
}, true);

surya said, on February 10, 2012 8:57 AM:

When a user enters a query in my output screen it must be directed to the google search engine and only the "Searches related to" terms should be displayed to the user in turn.Please provide me the coding.It will be very much helpful if you provide it.

Kumargaurav said, on February 10, 2012 11:14 PM:

Hi Dave....


This is Kumargaurav from Master in computer application i want to know
1.How i can create a google document ?????
2.Create a blog & give a post on it....???

Archit said, on February 15, 2012 6:22 AM:

Hey Dave,can you please tell me why 'name="q"'has been used as I have used this bar in my assignment ?

Yogesh said, on February 22, 2012 3:23 AM:

Hi. The above information has been very useful for me. The only thing I am concerned with is --- Can i place an Image of magnify glass instead of search button. If so can anyone please help me with the same.

Don said, on March 9, 2012 11:23 AM:

I purchased the google search engine, went through the setup steps, copied the code into my test page. Put it on my server and when I go to that page, it says "Loading" for a second, then nothing.

When I view the source code the code they supplied is there, just nothing on the page.

I looked at their "support forum" and almost nobody has posted in almost a month. And I was logged in, submitted my post. Saw it in that forum category, now I go back to make an edit, and my post is gone.

Thanks Google. Almost no support and the simpliest test does zilch.

Anyone have any ideas or links I can go to work through this?

Thanks in advance,
Don

Sergey said, on March 15, 2012 7:44 AM:

Hi Don

> Anyone have any ideas or links I can go to work through this?

BTW there're other services that have better support and more interesting features. Like for example http://getwebsitesearch.com/

Babar hussain said, on March 19, 2012 9:45 AM:

Hi this is my 1st website

Sean said, on March 20, 2012 10:48 AM:

Can I use this code on a subdirectory within my main domain? Or better yet can this code be used to only search a specific html page and not the whole domain?

kkreiven said, on March 20, 2012 5:51 PM:

This is my version for mobile sites...

<form method="get" action="http://www.google.com/m/search">
<input type="text" name="q" size="19"
maxlength="255" value="Google it" style="font-size:x-small" /><br/>
<select name="site" style="font-size:x-small">
<option value="mobile">mobile</option>
<option value="universal">net</option>
<option value="images">image</option>
</select>
<input type="submit" value="Go" style="font-size:x-small" />
</form>

Dave Taylor said, on March 20, 2012 6:00 PM:

Nice job with that, KKreiven!

Abdullah said, on March 21, 2012 7:04 AM:

thanx its grear to us this script its v simple and easy to use best wishes to script writer

akshay said, on March 24, 2012 10:30 AM:

i want to search top t0 tweats with the keyword i enter on my website and the results should be display on my website..??
can u show how can i do it???

TP said, on April 1, 2012 2:48 PM:

Hi, I would like to add a search that only returns .co.uk sites. Is this possible please??

Thank you

Dave Taylor said, on April 1, 2012 11:06 PM:

TP, yes. What you need to do is append " site:co.uk" to the end of the search pattern the user enters before you actually submit the search. I imagine the easiest way to do that would be to slip it into an OnClick event handler in the submit button. Good that phrase, you'll see examples of what I'm talking about. :-)

ravi said, on April 12, 2012 5:36 AM:

Why should we only use name="q" for the text input,
i tried to change but the search is not working when i change it, So can any one tell me why we should use "q" only.
I need the information because i am using this search box in my assignment.
Thank you.

Dave Taylor said, on April 12, 2012 9:52 AM:

Ravi, it's because the program on the server that gets the search query is looking for 'q' as the name of the variable that contains the search word or term that you seek. Change it on the page and you also have to change the program to match.

Maricelys said, on April 13, 2012 6:39 PM:

Thanks a lot!!!

Ravi chandar said, on April 20, 2012 6:40 AM:

I want to add my company name in google autocompletion search box. how can i?? for example, my company name is 'fast ride calltaxi', i want this in the autocompletion google search if i type just fast....

Anum said, on April 21, 2012 12:29 PM:

hi, i put the following codes into my website, and i intend to let people search a product in my site only.. please let me know if the following codes are correct for that???? plz do reply me..i badly need your reply...












jsmb said, on April 25, 2012 4:58 AM:

Hello, very nice, thanks, But can i also use this on offline pages? For html pages on my harddisk?

gaurav said, on April 26, 2012 10:41 AM:

i want to create a small search engine and wants to display the search result from the google or any other search engine into my search engine.... does anyone knows how to do that?

Bholi said, on April 27, 2012 5:26 PM:

Thanks for providing the code to help us improve our Web site. It's through generous people like you that we've been able to avoid paying lots of money for programmers. Thanks!

Charles Blundon said, on April 28, 2012 2:52 AM:

Dave, I really like your site. I have found that the way you present information is a lot easier to follow and use than other places. Thank you for the help!

Zabi said, on May 2, 2012 12:57 AM:

Hello Dave,

I have placed google search in my website, but its showing only index page when i type some keywords, Can you help me how to list more than 3 pages while search button is clicked, Please check this website (zeusmedcare.com)

Manish Modgill said, on May 6, 2012 6:03 AM:

Hello Sir,
i have to appear the results of the search in my own website on a specific div then, how to do it?

Bill said, on May 7, 2012 3:36 PM:

Thanks man! This is helpful.

nixonok said, on May 11, 2012 12:40 PM:

dude,you realy are good!thank you ,

Charles Kiyimba said, on May 17, 2012 1:46 PM:

Thanks a lot for this useful information. You deserve a thumbs-up.

ganesh said, on May 26, 2012 12:18 AM:

HI, Dave I have cpy/pstd your code in my site, its working fine, but can I show the results in my own page like mydomain.com/results.html.

Previously I was using a google code that had this option to show search results in desired page..


any suggestion appreciated
Regards

Stanley Straub said, on May 27, 2012 11:25 AM:

Hi Dave,
I want to add the search capability to my website, but when I copy your code and put it on my front page and do a preview, all I see is the code and not the search box like you show. Any help will be appreciated.

Thanks,
Stan

Daniel said, on June 1, 2012 2:00 PM:

Very help full. exactly what i was in search. thanks you

David1979 said, on June 9, 2012 10:13 AM:

Hi, I am trying to integrate it into the search field of the following template but without any success! Here is the template: http://www.templatescreme.com/demo/fashion-magazine/104

The search field must not change! I like it the way it is!

Also I like it to direct the visitor to a search page that looks similar in look and feel to my page

Will appreciate your help. Thanks & Love

Dave Taylor said, on June 14, 2012 9:00 AM:

Stanley and others who are finding that you see the *source code* to the search box, rather than the box itself in your web page editor, you need to enter the code when you're looking at the *code* to your existing page. Most of these web page editors have a "raw html" mode: that's what you need to use. Then it should work just fine. Good luck!

Leta said, on June 15, 2012 3:07 PM:

Absolutely clean and beautiful.

Thank you so much!!! Don't tell Google but yours is far superior.

raju said, on June 15, 2012 11:56 PM:

i prepared code in html.i get the webpage how can use those web pages for creating website.please send me further process creating website.

Daz said, on June 20, 2012 9:09 AM:

Hi Dave, great bit of code that works a treat.

I've used the top code to add a search box to a new site I'm currently building but just wondered if it was possible to tweak the code to remove the radio buttons completely and for the search box to only show the text box and search button but nothing more and show results from my site only. Any help would be greatfully appreciated.

Thanks once again for the code and for making my life much simpler.

tumpa said, on June 22, 2012 12:16 AM:

good for learning

John Onwuegbu said, on June 25, 2012 3:48 PM:

I had always preferred a native search box for my site to installing Google Search box. And the reason basically is that readers (especially the techies) tend to see Google search box as been a monetization scheme, so seldom uses it.

Rashmi said, on July 5, 2012 11:40 PM:

This is a great article ! Thank you :)

Rupam said, on July 7, 2012 1:09 AM:

Hi Dave, i have a question to ask... its related to google search but not serach box.

I have developed a site for someone (an artist from CA). when she searches her site on google, on page 2 or 3 few search result comes up showing only the menu flash or the main flash (.swf) file but not any page. I found similer thing happens with other site also (i tried with yahoo, barbarabarry etc). my question is: is this normal? is there any security issue involved in such case? if so what i need to do to prevent this?

I'm a designer turned developer and novish, not have much idea on SEO. Any idea/suggestion will be highly appeciated. Thanks a lot in adv.

kiran khan said, on July 15, 2012 6:04 AM:

THIS IS A BEST WAY...
THANKSSSSS FOR HELP ME

Cendekiawan IT said, on July 26, 2012 7:44 PM:

i like this box for search... simple and powerfull... thank

dave said, on August 7, 2012 10:39 AM:

hi dave

what do i need to do if i want the results to appear on my site

Many Thanks
Dave

sunni and shia said, on August 14, 2012 3:08 AM:

Nice sample code for Adsense search box.

JeHad Hussein said, on August 28, 2012 9:50 PM:

thnx for this box . it simple and nice, i will add to my blog.

sahar said, on September 2, 2012 3:44 PM:

ur code is realy nice
thanks a lot...

Gabriel Harper said, on September 30, 2012 2:27 PM:

You can also just add a search for Google+ only on your site:

http://www.scriptalicious.com/blog/2011/08/add-google-plus-search-to-your-website/

Christian said, on October 2, 2012 7:22 AM:

Hi, I created a search box like yours, but I was wondering if there is any way I can make the search results to appears in my sime site instead of going to google?

selina123abc1 said, on October 3, 2012 1:09 PM:

this is confusing

Caleb said, on October 10, 2012 10:13 PM:

Thanks so much Dave, you just made my day!

Mia Bee said, on October 18, 2012 11:14 AM:

When I add the coding it 1) creates a sort of "page break" between it and the rest of the site. And 2) trying to search only sends you to the home page, regardless of searching my site or the world wide web.

Norma said, on October 20, 2012 6:41 AM:

Hi, I'm concerned about a search box created by my website designer. He says is a google search bar. It works, shows results from google and our website, but when you click on any of our website links, it does not work, it takes you to an ERROR PAGE NOT FOUND.
Please let me know what should we do or if it takes time for it to work (website went live 3 days ago).
Thank you in advance for your help. I really appreciate it.

jerry said, on October 26, 2012 5:44 AM:

thanks alot, at least now i can add a search box to my site.

Rrapo said, on October 30, 2012 11:43 AM:

You are the best Dave!

Razvan said, on November 1, 2012 6:42 AM:

Hello Dave!

The tutorial is really nice and helpful, but it can be improved. I would like to know how can I integrate the search results page into my website.

Ca you tell me?

Thank you!

Amy said, on November 14, 2012 2:59 AM:

Thanks Dave!

nilkamal mandi said, on November 17, 2012 7:59 PM:

this html tag is quite good but i want a deferent one...this serch tag for google but i want a search tag that only shows the result of my personal site...please tell me

GL said, on November 18, 2012 9:12 AM:

Dave,
Do I have to put the "value ="ask...." line?

justin said, on November 29, 2012 10:48 AM:

is there a way to make the following code also show pictures on the search?

justin said, on November 29, 2012 10:50 AM:

also, is there a way to make it so that you DO NOT have to check the site seach box... in other words, so that it automatically searches your site and NOT google? thank you, you are awesome

Dave Taylor said, on November 29, 2012 10:58 AM:

Image inclusion is a function of the results Google finds. If it's a search of just your own site, I don't think it'll include images by default. And in terms of having it automatically just choose your own site, that's doable by turning the "type=checkbox" into "type=hidden" (which then lets you clean up the code a bit too:

<input type="hidden" name="sitesearch" value="askdavetaylor.com" />

See what I mean? Easily done once you know how to tweak the HTML.

Sarath baby said, on December 2, 2012 6:24 AM:

Like this you can also create a twitter search box within ur site! This is codded by myself. Its so easy if you know it!
<form method="get" action="http://twitter.com/search" target="_blank"><input type="text" name="q" alt="Search" value="" maxlength="256" size="32" /><input type="submit" value="Search" /></form>

Abitha said, on December 12, 2012 5:36 AM:

its nice but i want to add a search box in my site it and i want it to search only within my site. i don't want it to search anything rather the info in my site. pls help me.

Hi said, on December 17, 2012 12:03 PM:

Is there any way to point the search to my own PC, as well as the internet?
Thanks.

Essienkan Ebong said, on January 3, 2013 6:22 AM:

Man, you should be a prof. your techniques are quite simple and so so easy to deploy. Thanks a lot.

satyendra singh said, on January 5, 2013 5:05 AM:

Thanks for the code.very happy.....

Nutty said, on January 9, 2013 5:03 PM:

Does it take time for the search bar to work, Dave? Because I've added it to my friends website but as i search for something, the search results with nothing.

Regards,
Nut

Edd said, on January 19, 2013 7:05 AM:

Hi,

It all works fine for me when hosted on a web based server but now I have set up a Linux based web server at home and nothing happens. I've tried searching for a solution but can't find anything. Any suggestions?

Edd

Neha said, on January 20, 2013 12:25 AM:

Hi,
I want an html code wherein on my site i type a word in a text box and then say submit.When i click submit it should show me an image of that searched word.And later i have to store that image with a user in the database..Can u help?

steven denger said, on February 15, 2013 8:24 PM:

The code you gave does not work. Neither did googles free one. Why do they offer free stuff that does not work? Goddle's made the picture but did not work. Yours came out all scrambled and with no power. How does one get a search box on one's site that freakin works!

Dave Taylor said, on February 15, 2013 8:44 PM:

That's confusing, Steven, because lots of people have used this exactly code snippet and had it work just fine. Are you sure you copied it into the "source" or "html" view of your page editor?

L.Shimer said, on February 16, 2013 4:29 AM:

Dave you're the man :)
Looks awesome and works like a charm, and i was not expecting the box to have a transparent border, a added plus.
You have to register to be able to view my sites layout but if you want to check it out here is the link: www.lawrenceshimer.com
PS don't worry , no porn or junk on my site and I run Nuke Sentinel and Cloud Flare.
Its just a place a few of my friends and I hang out at (were old school gamers)lol

Nathan McLain said, on February 20, 2013 4:01 PM:

Hi Dave,
We have a page that has many publications listed, so I added the Google search box to the page using the specific URL to just that page. I thought I was being smart until I realized that when you click on a search result it's just going to take you back to the page and not to the specific spot on the page that was searched for. EX) If my name is far down on the page, I search for my name, click on the link, it just takes me back to the top of the page instead of where you can find my name on the page. It's probably wishful thinking, but do you know if there is any way to set up a search like this, where when you click on the link in results it takes you to a specific spot on the page?
Thanks,
Nathan

Jullian said, on February 22, 2013 12:34 PM:

How do i save this, because everytime i add it it appears and then doesn't stay!

shakila.ausaf. said, on February 23, 2013 3:02 AM:

sir,
I get add different company/product but how i can get.
please tell me '
Thank you.

adiat said, on March 9, 2013 3:37 AM:

thanks a lots for your helpfull code.

Abhishek said, on March 18, 2013 2:08 AM:

Works well, thanks. This is the minimum code to have Google Search into your website and its very easy to customize using CSS. Simply great.

Ian Robson said, on March 24, 2013 5:25 PM:

Hi Dave

Just love your article "How can I add a Google search box to my Web site?"

My question: How can I show the result of a search on a custom webpage on my site?


Sam Syrchae said, on March 26, 2013 1:59 PM:

Woooh! There are lots of comment on this article. Nice stuff you have in here Dave. At least you have provided much information for all the webmasters out there especially those beginners who does not know so much yet on designing a site. I am not using google custom search or any google product for my own site search tool but I do appreciate this article.

Michael Stevens said, on April 2, 2013 8:09 AM:

Nice one Dave really helped me out.

Clifford said, on April 7, 2013 7:52 PM:

Thank you Dave. Quick, simple, and EFFECTIVE. Just added it to my website and works like a charm. Added 3 more radio buttons for industry specific sources. Very much obliged.

Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you, Dave, for all your helpful information by buying you a cup of coffee!
 1  |  2  |  3  |  4  |  5  |  6  |  7  |  8  |  9  | All 9 Pages

I do have a comment, now that you mention it!











I will never send you any unsolicited email. Ever.






Check This Out Too...

 
Look for Answers
Need Help? Ask Dave Taylor!


Follow Me on Pinterest

Find Me on Google+
ADT on G+
© 2002 - 2013 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site. Further, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site. My lawyer says "Thanks".
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.