Hello and welcome everybody,
Last few days one of my
colleagues was very much frustrated about integration of goggle search within
website i.e. the search results should be displayed in the website page.
Here I got one simple and
best solution to implement the Google search within website. Here it goes:
Step1:
Add the below code within
your Body tag
<div class="search_form">
<form action="googlesearch.html"
id="searchbox_000749512340315565477:ouvhgxqh7q8">
<input type="hidden"
name="cx"
value="000749512340315565477:ouvhgxqh7q8" />
<input type="hidden"
name="cof"
value="FORID:11" />
<input type="text"
name="q"
class="search" size="25"/>
<input type="submit"
name="sa"
value="Search" class="submit"
/>
</form>
<script type="text/javascript"
src="http://www.google.com/coop/cse/brand?form=searchbox_000749512340315565477%3A
ouvhgxqh7q8&lang=en"></script>
</div>
Step: 2
Write the below code for
search result:
<div class="left"
style="width:100%;">
<h3>Search Results:</h3>
<div class="left_box">
<div
id="results_000749512340315565477:ouvhgxqh7q8"></div>
<script type="text/javascript">
var
googleSearchIframeName =
"results_000749512340315565477:ouvhgxqh7q8";
var
googleSearchFormName =
"searchbox_000749512340315565477:ouvhgxqh7q8";
var
googleSearchFrameWidth = 600;
var
googleSearchFrameborder = 0;
var
googleSearchDomain =
"www.google.com";
var
googleSearchPath = "/cse";
</script>
<script type="text/javascript"
src="http://www.google.com/afsonline/show_afs_search.js"></script>
</div>
</div>
Now save your file as “googlesearch.html”.
I hope it will help you out!
Cheers,
Ved Pathak
Comments