11/16/2011

How to Add Google Search Box to Search Your Web Site?

Tips Joy - computing, housework, health, gardening. FREE HTML Codes to Add a Google Search Box to Search Your Web Site
 
Problems: : I added a google search box on my website, but it searches all web sites (not my own web site).

Free Google search box tips: Some free HTML/CSS codes are available on line and you can just cut and paste it onto the preferred location of your own Web pages to produce the search box you need - let you either search your own entire site or search the entire Google database (all web sites).

Here is a very good one from www.askdavetaylor.com 
 
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.

If you'd like to use this on your own site, simply change the occurrences of yoursite.com as appropriate.

<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="yoursite.com" checked /> only search Your Site<br />
</td></tr></table>
</div>
</form>



If you want to redirect the result of that form to a new window called "new", you just needs to add the target="new" to the first line.

<form method="get" action="http://www.google.com/search" target="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">


Related Topics:
How to Find IP Address and Lookup its Location?
Easy YouTube Videos Download
Run Windows System Restore to solve computer problem

No comments:

Post a Comment