Thursday, May 19, 2011



Yahoo PlaceMaker and Maps Client


  
    My Google API Application
    

    
    //
    google.load("search", "1");

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


//create LocalSearch object

//create a LocalSearch instance
function initialiseLocalSearch()
{
localSearch = new google.search.LocalSearch();

//we want lots of results (actually only 8)
localSearch.setResultSetSize(google.search.Search.LARGE_RESULTSET);

//set the Local Search centre point (a geographic location)
localSearch.setCenterPoint("");

//Set searchComplete as callback function when a search is
//complete. The localSearch object will hold results
localSearch.setSearchCompleteCallback(this, searchComplete, null);

//include teh required Google branding
google.search.Search.getBranding('branding');
}

function searchComplete() {
var result_element = document.getElementById("result-div");

//if we have at least 1 search results
if(localSearch.results && localSearch.results.length > 0)
//loop through the results
{
for(var i = 0; i < localSearch.results.length; i++)
{
var result = localSearch.results[i];

//a result element's html property contains a DOM tree
//make a complete copy of it to add to our page

var result_node = result.html.cloneNode(true);

//add the result to some element in our page
result_element.appendChild(result_node);

}
}



}

      // 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("Hamilton, New Zealand");

//remove the results of any previous queries
localSearch.clearResults();

//carry out a searh for the given query string
localSearch.execute("cafes");
}

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

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

    //]]>
    
  
  
    Loading...

  




My Google API Application




Loading...