AJAX Search API:
In the Ajax Code The Default Search "Google Sites" only may need to be changed.
Ajax API Playground
The Gadget background color (black or HEX value #000000) should also be changed to match your Google Site.
Using the GGE ( Google Gadget Editor) and the Ajax Api code below.
Save the XML file (When logged in to your google account)
In Google sites Insert> More Gadgets > Add Gadget by URL
Google Sites- Ajax Search Example:
- Gadget Preview may not be compatible with some browsers/devices.
- Gadget Preview Supported by the Firefox Browser.
Ajax Search API - Search Controls
Video Search Blog Search News Search Image Search Book Search Patent Search
KML KMZ Search [labs]
Ajax Search Example Code:
<?xml version="1.0" encoding="UTF-8"?> <Module> <ModulePrefs title="Google Sites- Ajax Search Example" height="600"> <Require feature="dynamic-height"/> </ModulePrefs> <Content type="html"> <![CDATA[ <style type="text/css">
body { background-color: #eeeeee; color: black; font-family: Arial, sans-serif; font-size : 13px; margin: 15px; }
#searchcontrol .gsc-control { width : 400px; }
</style> <script src="http://www.google.com/jsapi" type="text/javascript"></script> <script type="text/javascript"> google.load('search', '1.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()); searchControl.addSearcher(new google.search.NewsSearch()); searchControl.addSearcher(new google.search.ImageSearch()); searchControl.addSearcher(new google.search.BookSearch()); searchControl.addSearcher(new google.search.PatentSearch());
// Set the Local Search center point localSearch.setCenterPoint("New York, NY");
// tell the searcher to draw itself and tell it where to attach searchControl.draw(document.getElementById("searchcontrol"));
// execute an inital search searchControl.execute("site:www.goopal.org google maps"); } google.setOnLoadCallback(OnLoad, true);
gadgets.window.adjustHeight() </script> <div id="searchcontrol">Loading</div> ]]></Content> </Module>
|