JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Web Search API Sample</title>
<!-- Google Search是從「Google Web Search API Developer's Guide( https://developers.google.com/web-search/docs/ )」範例改寫而成的 -->
<!-- 首先Load Google Web Search API -->
<script src="https://www.google.com/jsapi" type="text/javascript"></script>
<script language="Javascript" type="text/javascript">
// Load Google Search Module
google.load('search', '1');
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("武陵農場");
// create a drawOptions object
var drawOptions = new google.search.DrawOptions();
// tell the searcher to draw itself in tabbed mode
drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
// tell the searcher to draw itself and tell it where to attach
searchControl.draw(document.getElementById("searchframe"), drawOptions);
// execute an inital search
searchControl.execute("武陵農場");
}
// To register the specified handler function to be called once the document loads
google.setOnLoadCallback(OnLoad);
</script>
</head>
<body>
<div id="searchframe">Loading</div>
</body>
</html>