Thursday, March 12, 2009

Google Search in asp.net page.

asp:content id="Content1" contentplaceholderid="ContentPlaceHolder1" runat="Server"
//put the following line in script:

putScriptHere src="http://www.google.com/jsapi?key=ABQIAAAAchOdSzCPe0fgAm8Ow24YYhQZMjxVy-0fy3B1JroJth17tbEUrRQwDlqM1PUlwiawvBO4RMVpYVIfLA"
type="text/javascript"

//put following also in script tag

google.load("search", "0");

function OnLoad() {
// Create a search control
var searchControl = new google.search.SearchControl();

// Add in a full set of searchers
var localSearch = new google.search.LocalSearch();
searchControl.addSearcher(localSearch);
searchControl.addSearcher(new google.search.WebSearch());
searchControl.addSearcher(new google.search.VideoSearch());
searchControl.addSearcher(new google.search.BlogSearch());

// Set the Local Search center point
localSearch.setCenterPoint("New Delhi, INDIA");

// Tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("searchcontrol"));

// Execute an inital search
searchControl.execute("");
}
google.setOnLoadCallback(OnLoad);


divSTART id="searchcontrol"
Loading.../divEND
/asp:content

No comments:

Post a Comment