2013-11-27 57 views
0

此代码在2个月前运行。我了解它已被弃用,但几个月前像10月初(2013年)那样运行良好。 Google是否再次更改其API?Google Site Search无法返回结果

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> 

回答