当前位置: 58彩票app下载 > 计算机网络 > 正文

API完结代码

时间:2019-09-18 11:14来源:计算机网络
Google AJAX 搜索 API 文档: key:ABQIAAAA8p3Bx0AYyZ4oRR6imyISPhTGleYHxCr9_m_RTspoaQwhWklirxT5vY9w1t2JVd3Zq_Lp5EZcFtSC1g 复制代码 代码如下:   !DOCTYPE html html head titleGoogle AJAX 搜索 API/title style type="text/css" #searc

Google AJAX 搜索 API 文档:

key:ABQIAAAA8p3Bx0AYyZ4oRR6imyISPhTGleYHxCr9_m_RTspoaQwhWklirxT5vY9w1t2JVd3Zq_Lp5EZcFtSC1g

复制代码 代码如下:

 

<!DOCTYPE html>
<html>
<head>
<title>Google AJAX 搜索 API</title>
<style type="text/css">
#searchcontrol .gsc-control
{
width: 100%;
}
#searchcontrol .gsc-result-cnblogs .gs-title
{
color:Red;
}
</style>
<script src="
JwBNft1mFrRRmR1RoYEUCZCj0dtS2gIc8Al4-VA"
type="text/javascript"></script>
<script language="Javascript" type="text/javascript">
google.load("search", "1");

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" ";
<html xmlns=";
  <head>
    <title>My Google API Application</title>
    <script src="" type="text/javascript"></script>
    <script language="Javascript" type="text/javascript">
    //<![CDATA[

function OnLoad() {
//找寻设置
var options = new google.search.SearcherOptions();
//当寻觅结果为空时彰显内容
options.setNoResultsString('查询结果为空!');

    google.load("search", "1");

//寻觅控件实例化
var searchControl = new google.search.SearchControl();
//每便展现8个寻找结果(取值范围:1-8)
searchControl.setResultSetSize(8);

    function OnLoad() {
      // Create a search control
      var searchControl = new google.search.SearchControl();

//网页找寻
var siteCnblogs = new google.search.WebSearch();
//标头
siteCnblogs.setUserDefinedLabel("脚本之家");
//样式后缀名
siteCnblogs.setUserDefinedClassSuffix("jb51");
//站点限制
siteCnblogs.setSiteRestriction("jb51.net");
searchControl.addSearcher(siteCnblogs, options);

      // Add in a full set of searchers
      var localSearch = new google.search.LocalSearch();
      searchControl.addSearcher(localSearch);
      searchControl.addSearcher(new google.search.WebSearch());

//局地寻找
var siteZjfree = new google.search.WebSearch();
siteZjfree.setUserDefinedLabel("素材搜索");
siteZjfree.setSiteRestriction("sc.jb51.net");
searchControl.addSearcher(siteZjfree, options);

      searchControl.addSearcher(new google.search.ImageSearch());
      searchControl.addSearcher(new google.search.VideoSearch());
      searchControl.addSearcher(new google.search.BlogSearch());

//全网找寻
searchControl.addSearcher(new google.search.WebSearch(), options);

      // Set the Local Search center point
      localSearch.setCenterPoint("New York, NY");

//增多博客找出
searchControl.addSearcher(new google.search.BlogSearch(), options);

      // Tell the searcher to draw itself and tell it where to attach
      searchControl.draw(document.getElementById("searchcontrol"));

//增添录制查找
searchControl.addSearcher(new google.search.VideoSearch(), options);

      // Execute an inital search
      searchControl.execute("Google");
    }
    google.setOnLoadCallback(OnLoad);

//增加新闻找出
searchControl.addSearcher(new google.search.NewsSearch(), options);

    //]]>
    </script>
  </head>
  <body>
    <div id="searchcontrol">Loading...</div>
  </body>
</html>

//增添图片检索
searchControl.addSearcher(new google.search.ImageSearch(), options);

//增添本地地图找出
var localSearch = new google.search.LocalSearch();
//地图中央标识 测验时可应用“北寺塔”
localSearch.setCenterPoint("西安,钟楼");
searchControl.addSearcher(localSearch, options);

//绘制搜索
var drawOptions = new google.search.DrawOptions();
drawOptions.setDrawMode(google.search.SearchControl.DRAW_MODE_TABBED);
searchControl.draw(document.getElementById("searchcontrol"), drawOptions);

//试行搜索查询
searchControl.execute("google api");
}

//框架加载成功后调用
google.setOnLoadCallback(OnLoad);
</script>
</head>
<body>
<div id="searchcontrol">
加载中...
</div>
</body>
</html>

你或者感兴趣的稿子:

  • ASP.NET搭配Ajax实现寻觅提示功效
  • php+ajax实时输入自动找出匹配的主意
  • ThinkPHP达成ajax仿官方网址找出成效实例
  • 怎么让找出引擎抓取AJAX内容实施方案
  • jquery创立一个ajax关键词数据检索达成思路
  • php+ajax做仿百度寻找下拉机动提醒框(有实例)
  • asp+ajax仿google寻觅提醒成效代码
  • asp.net和ajax达成智能搜索效果代码
  • 依照ajax的简单寻找实现格局

编辑:计算机网络 本文来源:API完结代码

关键词: