How-to: Add a Google Search Box to your blog

Here’s a quickie for those of you who want to add a Google search box to your blog or website. It’s a lot easier than one would think. ;)

I finally got the right idea of what I was looking for after haggling with Google’s Ajax search API - if you want to have an almost fully functioning mini-Google on your site, definitely go ahead and install that. I will warn you though, it can get a bit confusing.

Instead of that, I finally found what I was looking for - a Google search box for my blog. This code is based on the code that is posted on Dave Taylor’s site; I’ve modified it to put the Google Search button on the bottom, after the option section, instead of between the search box and the options.

To add the code to your Blogger blog - if you’re using “New” Blogger - make a new Widget - an HTML/Javascript widget and give it whatever title you’d like. Edit it and put this code in, substituting your site’s address (without http://) and name where indicated.

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

<input maxlength=”255″
value=”" name=”q” size=”31″ type=”text”/><br/>
<input value=”" name=”sitesearch” type=”radio”/>
The Web
<input checked
value=”YOUR BLOG ADDRESS” name=”sitesearch” type=”radio”/>YOUR BLOG’S NAME<br/>
<input value=”Google Search” type=”submit”/>

</form></center>

If you find that the search box doesn’t fit into your site’s style (i.e. it’s too wide, or too narrow) - just make the number in the size section (currently 31) larger or smaller, depending on your needs.

Save the changes, and you’re set with a Google search box on your blog! ;)

Share and Enjoy:
  • Digg
  • del.icio.us
  • StumbleUpon
  • co.mments
  • Bumpzee
  • Sphinn
  • Twitter
  • Technorati
  • Netscape

Similar Posts

1 Comment »

  1. SHIV said,

    May 1, 2008 @ 7.00 pm

    THANKS FOR THE HELP ABOUT ADDING THE SEARCH BOX ON MY BLOG.

RSS feed for comments on this post · TrackBack URI

Leave a Comment

Readers who viewed this page also viewed: