zoukankan      html  css  js  c++  java
  • Google AJAX API 入门笔记(一)

    1.首先,从Google网站注册一个相关Google AJAX API密钥;

    2.使用 Google 地球 API 要在网页中载入 Google 地球插件,您需要进行以下操作:

      I.载入 Google 地球 API[用相关密钥来替换以下内容中的ABCDEFG部分]。

    <script src="http://www.google.com/jsapi?key=ABCDEF"></script>

      II.创建 DIV 元素来包含该插件。

    <div id="map" style=" 800px; height: 600px;" />

      III.创建初始化插件的函数。

    代码
      var ge;
      google.load("earth", "1");
      function init() {
         google.earth.createInstance("map", initCallback, initFailure);
      }
      function initCallback(instance) {
         ge = instance;
         ge.getWindow().setVisibility(true);
      }
      function initFailure(errorCode) {
      }
     
     IV.网页载入后,调用该初始化函数。
    google.setOnLoadCallback(init);

      V.完整代码:

     
    代码
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        
    <title>Google Earth</title>
        
    <meta content="text/html; charset=utf-8" http-equiv="content-type" />
        
    <script src="http://www.google.com/jsapi?key=ABCDEFG"></script>
        
    <script language="javascript" type="text/javascript">
        
    // <![CDATA[

            var ge;
            google.load(
    "earth""1");

            function init() {
                google.earth.createInstance(
    "map", initCallback, initFailure);
            }

            function initCallback(instance) {
                ge 
    = instance;
                ge.getWindow().setVisibility(
    true);
            }

            function initFailure(errorCode) {
            }

            google.setOnLoadCallback(init);

        
    // ]]>
        </script>
    </head>
    <body>
        
    <div id="map" style=" 800px; height: 600px;">
        
    </div>
    </body>
    </html>
  • 相关阅读:
    iOS软件版本更新思路
    Xcode里-ObjC, -all_load, -force_load
    NSFileManager
    [Android问答] px、dp和sp,这些单位有什么区别?
    annot refer to a non-final variable * inside an inner class defined in a different method"错误解析
    android Handler post sendMessage
    谈layout_gravity和gravity的用法
    Android LayoutInflater详解
    Android中pendingIntent的深入理解
    Intent和PendingIntent的区别
  • 原文地址:https://www.cnblogs.com/gaotang/p/1771582.html
Copyright © 2011-2022 走看看