google ajax search 示例

xml 代码
  1. >  
  2. <html xmlns="http://www.w3.org/1999/xhtml">  
  3.   <head>  
  4.     <meta http-equiv="content-type" content="text/html; charset=utf-8"/>  
  5.     <title>Hello World - Google AJAX Search API Sampletitle>  
  6.     <link href="http://www.google.com/uds/css/gsearch.css" type="text/css" rel="stylesheet"/>  
  7.     <style type="text/css">  
  8.   
  9.     body {   
  10.       background-color: white;   
  11.       color: black;   
  12.       font-family: Arial, sans-serif;   
  13.       font-size: small;   
  14.       margin: 15px;   
  15.     }   
  16.   
  17.     .gsc-control { width : 400px; }   
  18.   
  19.   
  20.     style>  
  21.     <script src="http://www.google.com/uds/api?file=uds.js&v=1.0" type="text/javascript">script>  
  22.     <script type="text/javascript">  
  23.         
  24.   
  25.     function OnLoad() {   
  26.       // Create a search control   
  27.       var searchControl = new GSearchControl();   
  28.       var drawElement = document.getElementById("searchResults") ;   
  29.       var searchForm = document.getElementById("searchForm") ;   
  30.   
  31.       // Add in a full set of searchers   
  32.       var localSearch = new GlocalSearch();   
  33.       searchControl.addSearcher(localSearch);   
  34.       searchControl.addSearcher(new GwebSearch());   
  35.       searchControl.addSearcher(new GvideoSearch());   
  36.       searchControl.addSearcher(new GblogSearch());   
  37.       searchControl.addSearcher(new GnewsSearch());   
  38.       searchControl.addSearcher(new GimageSearch());   
  39.       searchControl.addSearcher(new GbookSearch());   
  40.   
  41.       // Set the Local Search center point   
  42.       localSearch.setCenterPoint("New York, NY");   
  43.   
  44.       // create a drawOptions object   
  45.       var drawOptions = new GdrawOptions();   
  46.   
  47.             // tell the searcher to draw itself in linear mode   
  48.             drawOptions.setDrawMode(GSearchControl.DRAW_MODE_LINEAR);   
  49.             // tell the searcher to draw itself in tabbed mode   
  50.             drawOptions.setDrawMode(GSearchControl.DRAW_MODE_TABBED);   
  51.                
  52.         //  drawOptions.setExpandMode(GSearchControl.EXPAND_MODE_OPEN);   
  53.   
  54.                
  55.             drawOptions.setSearchFormRoot(searchForm);   
  56.   
  57.   
  58.   
  59.             searchControl.draw(drawElement, drawOptions);   
  60.   
  61.       // execute an inital search   
  62.       searchControl.execute("http://fly-net-cn.iteye.com/");   
  63.     }   
  64.     GSearch.setOnLoadCallback(OnLoad);   
  65.     
  66.     script>  
  67.   head>  
  68.   <body>  
  69.     <table width="100%">  
  70.       <tr>  
  71.         <td class="content" valign="top" width="60%">  
  72.           <div id="content">  
  73.             <div id="searchResults">Loading...div>  
  74.           div>  
  75.         td>  
  76.         <td class="sidebar" width="40%">  
  77.           <div id="sidebar">  
  78.             <h2>Searchh2>  
  79.             <div id="searchForm">Loading...div>  
  80.           div>  
  81.         td>  
  82.       tr>  
  83.     table>  
  84.   body>  
  85. html>  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值