xml 代码
- >
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
- <title>Hello World - Google AJAX Search API Sampletitle>
- <link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet"/>
- <style type="text/css">
- body {
- background-color: white;
- color: black;
- font-family: Arial, sans-serif;
- font-size: small;
- margin: 15px;
- }
- .gsc-control { width : 400px; }
- style>
- <script src="http://www.google.com/uds/api?file=uds.js&v=1.0" type="text/javascript">script>
- <script type="text/javascript">
- function OnLoad() {
- // Create a search control
- var searchControl = new GSearchControl();
- var drawElement = document.getElementById("searchResults") ;
- var searchForm = document.getElementById("searchForm") ;
- // Add in a full set of searchers
- var localSearch = new GlocalSearch();
- searchControl.addSearcher(localSearch);
- searchControl.addSearcher(new GwebSearch());
- searchControl.addSearcher(new GvideoSearch());
- searchControl.addSearcher(new GblogSearch());
- searchControl.addSearcher(new GnewsSearch());
- searchControl.addSearcher(new GimageSearch());
- searchControl.addSearcher(new GbookSearch());
- // Set the Local Search center point
- localSearch.setCenterPoint("New York, NY");
- // create a drawOptions object
- var drawOptions = new GdrawOptions();
- // tell the searcher to draw itself in linear mode
- drawOptions.setDrawMode(GSearchControl.DRAW_MODE_LINEAR);
- // tell the searcher to draw itself in tabbed mode
- drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);
- // drawOptions.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);
- drawOptions.setSearchFormRoot(searchForm);
- searchControl.draw(drawElement, drawOptions);
- // execute an inital search
- searchControl.execute("http://fly-net-cn.iteye.com/");
- }
- GSearch.setOnLoadCallback(OnLoad);
- script>
- head>
- <body>
- <table width="100%">
- <tr>
- <td class="content" valign="top" width="60%">
- <div id="content">
- <div id="searchResults">Loading...div>
- div>
- td>
- <td class="sidebar" width="40%">
- <div id="sidebar">
- <h2>Searchh2>
- <div id="searchForm">Loading...div>
- div>
- td>
- tr>
- table>
- body>
- html>