Wednesday, June 3, 2009

How to embed a google search engine in your blog

How?

Step 1:
Click Customize -> Layout -> Page Elements -> add a Gadget
Step 2:
Selet the "HTML/Javascript", in the textarea copy and paste either the "code for radio style search box" or "code for checkbox style search box" listed below.
Step 3:
Change the following fields accordingly:
<input type="radio" name="sitesearch" value="YOURSITE" checked />YOUR SITE<br />

<input type="checkbox" name="sitesearch" value="YOURSITE" checked /> only search YOUR SITE<br />

Step 4:
Save the change and Done.




only search Cyber Jedi


code for radio style search box:

<form method="get" action="http://www.google.com/search" target="_blank">
<input type="text" name="q" size="25" maxlength="255" value="" />
<input type="submit" value="Google Search" />
<input type="checkbox" name="sitesearch" value="cyberjedizen.blogspot.com" checked /> only search Cyber Jedi<br />
</form>





The Web Cyber Jedi


code for checkbox style search box:

<form method="get" action="http://www.google.com/search" target="_blank">
<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="cyberjedizen.blogspot.com" checked /> Cyber Jedi<br />
</form>

Why?
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 to to the domain.

You can either use radio button or check box for the sitesearch field. Notice the target="_blank" in the <form> tab, which create a pop up window instead of let the user clicking away from your site.


[ Supporting files]
[ Socialize This]

No comments:

Post a Comment

meta.ai impression

Meta.ai is released by meta yesterday, it is super fast you can generate image while typing! You can ask meta.ai to draw a cat with curvy fu...