<!--
Original Copyright (c) 2008 Google Inc.
You are free to copy and use this sample.
License can be found here:
http://code.google.com/apis/ajaxsearch/faq/#license
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Bruce Chapin's adaptation of Google HelloWorld sample script</title>
<style type="text/css">
body {
background-color: lightblue;
color: black;
font-family: Arial, sans-serif;
}
#searchcontrol .gsc-control { width : 400px; }
</style>
<script src=http://www.google.com/jsapi type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
google.load('search', '1.0');
function OnLoad() {
// Create a search control
var searchControl = new google.search.SearchControl();
// Add in a full set of searches
var localSearch = new google.search.LocalSearch();
searchControl.addSearcher(localSearch);
searchControl.addSearcher(new google,search.WebSearch());
searchControl.addSearcher(new google.search.NewsSearch());
// Set the Local Search center point
localSearch.setCenterPoint("Omaha, NE");
// tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("searchcontrol"));
// execute an initial search
searchControl.execute("BrightHub");
}
google.setOnLoadCallback(OnLoad, true);
//]]>
</script>
</head>
<body>
<div id="searchcontrol">Loading</div>
</body>
</html>
This is a very basic implementation of the Google Search API. See the Developer's Guide for a more detailed explanation, including setting options.