此代码大约2个月前正在运行。我知道它已被弃用,但几个月前它像10月初(2013年)一样正常运行。谷歌又改变了他们的API吗?
google.load('search', '1');
function OnLoad() {
// Create a search control
var searchControl = new google.search.SearchControl();
// Add in a WebSearch
var webSearch = new google.search.WebSearch();
// Restrict our search to pages from the Cartoon Newtowrk
webSearch.setSiteRestriction('stmikes.utoronto.ca');
// Add the searcher to the SearchControl
searchControl.addSearcher(webSearch);
// tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("content"));
// execute an inital search
searchControl.execute('SMC');
}
google.setOnLoadCallback(OnLoad);
HTML
<div id="content">Loading...</div>