The last two months to visit Google's old ventilation, also 8 know what the great gfw made of what means. Although the form is not optimistic, still see the dog released Google AdSense API and Google search Ajax API, the latter is obviously more practical value. So I used the potential of the swift theft of the manual API key, in reference to the online after, or use the actual code to speak it:
Copy Code code as follows:
function OnLoad () {
Create a Search control
var SearchControl = new Gsearchcontrol ();
Search options, set here to automatically expand
var options = new Gsearcheroptions ();
Options.setexpandmode (Gsearchcontrol.expand_mode_open);
Added a web search
Searchcontrol.addsearcher (New Gwebsearch (), options);
Search results Output options, List display gsearchcontrol.draw_mode_tabed is another option, tab shows various search results
var drawoptions = new Gdrawoptions ();
Drawoptions.setdrawmode (gsearchcontrol.draw_mode_linear);
Show 8 results at a time
Searchcontrol.setresultsetsize (Gsearch.large_resultset);
Tell the searcher to draw itself and tell it where to attach
Searchcontrol.draw (document.getElementById ("SearchControl"), drawoptions);
Start Search
Searchcontrol.execute ("Google");
}
The current version of the API is 0.1, after the release of the official version 1.0, the search results will be advertising, apparently the lunch is not free.
- Here I wrote the demo (if not access, indicating that Google began to exhaust the)-http://www.ooso.net/temp/demo/search.html
- Google AJAX Search API Example
http://code.google.com/apis/ajaxsearch/documentation/#AdvancedSamples