Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

Search your web page with Google's Engine

, 17 Jan 2011
Rate this:
Please Sign up or sign in to vote.
Search your web page with Google's Engine
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 what programming language you use.

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 which contains a hidden field with the URL where we want Google to search, an input (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 opened 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&as_q=silverlight
 

Working Example

If you want to check how it works, just check this example.
Hope you like it. As ever, please feel free to leave any comment, suggestion or question.
 
Thanks for reading!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

nereo.lopez
Team Leader
Spain Spain
No Biography provided
Follow on   Twitter

Comments and Discussions

 
GeneralReason for my vote of 5 Cool one. Pinmvpthatraja30-Mar-11 5:57 
GeneralRe: Hey, thanks Thatraja! Pinmembernereo.lopez31-Mar-11 20:43 
GeneralReason for my vote of 4 because it helped me. was a new thin... Pinmemberahsan sarfraz23-Jan-11 21:00 
GeneralRe: Well, thanks for voting! Hope you can take advantage of it :... Pinmembernereo.lopez23-Jan-11 21:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 17 Jan 2011
Article Copyright 2011 by nereo.lopez
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid