Tuesday, August 3, 2010

How to Put Google Search Engine Your Web sites ??

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.

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.

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:

write down this code in notepad save it as search.html::

<form action="http://www.google.co.in/cse" id="cse-search-box">
  <div>
    <input type="hidden" name="cx" value="partner-pub-0332546587647614:8760757066" />
    <input type="hidden" name="ie" value="UTF-8" />
    <input type="text" name="q" size="55" />
    <input type="submit" name="sa" value="Search" />
  </div>
</form>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("elements", "1", {packages: "transliteration"});</script>
<script type="text/javascript" src="http://www.google.com/cse/t13n?form=cse-search-box&t13n_langs=am%2Car%2Cen%2Cbn%2Ckn%2Chi%2Cel%2Cml%2Cmr%2Cne%2Cfa%2Csr%2Cur%2Cti%2Csa%2Cte%2Cpa%2Cta%2Cru%2Cgu"></script>

<script type="text/javascript" src="http://www.google.co.in/coop/cse/brand?form=cse-search-box&amp;lang=en"></script&gt;



As result you can see this in your sites::







2 comments: