在asp.net 頁面中添加google 搜尋

來源:互聯網
上載者:User

1.google api 搜尋的調用

應用的js檔案是

<script type="text/javascript"  src="http://www.google.com/afsonline/show_afs_search.js"></script>

2.初始化變量

<script type="text/javascript">    var googleSearchIframeName = 'googleSearchUnitIframe';    var googleSearchFrameWidth = 700;    var googleSearchFrameborder = 0;    var googleSearchDomain = 'www.google.com';</script>

3.返回結果的div

<div id="googleSearchUnitIframe"></div>

4.全部html代碼如下:

View Code

<html><head></head><body>    <form method="get" target="_top"><table border="0" bgcolor="#FFFFFF"><tr><td nowrap="nowrap" valign="top" align="left" height="32"></td><td nowrap="nowrap"><input type="text" name="as_q" size="64" maxlength="255" value="" id="sbi" /><input type="submit" name="sa" value="查詢" id="sbb"></input></td></tr><tr><td>&nbsp;</td><td nowrap="nowrap"><table><tr><td><input type="radio" name="sitesearch" value="" checked id="ss0" /><label for="ss0" title="Search the Web"><font size="-1" color="#000000">Web</font></label></td><td><input type="radio" name="sitesearch" value="sohu.com" id="ss1" /><label for="ss1" title="Search sohu.com"><font size="-1" color="#000000">搜狐</font></label></td><td><input type="radio" name="sitesearch" value="cnblogs.com" id="ss2" /><label for="ss1" title="Search cnblogs.com"><font size="-1" color="#000000">部落格園</font></label></td></tr></table><input type="hidden" name="client" value="pub-5243795963266234" /><input type="hidden" name="forid" value="1" /><input type="hidden" name="ie" value="UTF-8" /><input type="hidden" name="oe" value="UTF-8" /><input type="hidden" name="cof" value="GALT:#008000;GL:1;DIV:#336699;VLC:#663399;AH:center;BGC:#FFFFFF;LBGC:#336699;ALC:#0000FF;LC:#0000FF;T:#000000;GFNT:#0000FF;GIMP:#0000FF;FORID:11" /><input type="hidden" name="hl" value="zh-CN" /></td></tr></table></form>         <h1 class="title">搜尋結果</h1>  <!-- Google Search Result Snippet Begins --><div id="googleSearchUnitIframe"></div><script type="text/javascript">    var googleSearchIframeName = 'googleSearchUnitIframe';    var googleSearchFrameWidth = 700;    var googleSearchFrameborder = 0;    var googleSearchDomain = 'www.google.com';</script><script type="text/javascript"  src="http://www.google.com/afsonline/show_afs_search.js"></script></body></html>

5.使用介面如下:

6.上面 就是google的調用需要用到的東西,下面是要查詢的內容的設置

<form method="get" target="_top">
<table border="0" bgcolor="#FFFFFF">
<tr><td nowrap="nowrap" valign="top
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.