Powered by Blogger.

Saturday, January 15, 2011

Tag: , , ,

Search your web page with Google's Engine

[UPDATE: this blog was moved to a new one]

Hi Everyone,

this time I want to show how you can add a search text box in your Web Page using Google's Search Engine, so you can get Full Search Functionality without writing any code, NO MATTER THE PROGRAMMING LANGUAGE YOU ARE USING.

HTML CODE



<form action="http://www.google.com/search" method="get" name="searchform"   target="_blank">
<table border="0" cellpadding="0" cellspacing="0"><tbody>
<tr>
    <td>
       <input name="sitesearch" type="hidden" value="http://nereolopez.blogspot.com" />
    </td>                       
    <td>
       <input alt="search" name="as_q" size="20" type="text" value="Search this web" />
    </td>             
    <td>
       <input title="Search" type="submit" value="Search" />
    </td>        
</tr>
</tbody>
</table>
</form>



EXPLANATION


This is just an HTML form wich contains a hidden field with the url where we want google to search, an imput (TextBox) where user can input what he/she wants to search, and a submit button.


The ACTION of the form is the Google's Search Engine url and will be open in a new tab in the browser when user clicks the submit button. As we are using the GET method, the resulting url would be something like this:


http://www.google.com/search?sitesearch=nereolopez.blogspot.com&amp;as_q=silverligth


WORKING EXAMPLE


If you want to check how it works, just check this example.


Hope you guys like it. As ever, please feel free to leave any comment, suggestion or question.


Thanks for reading!

About Nereo Lopez

Hi, this is Nereo. I've spent my first professional years as .Net Software Engineer, and then moved more into Agile Methodologies. Anyway, I keep playing with all the new technologies that appear, and specially love Hybrid Apps!

0 comentarios:

Post a Comment