zoukankan      html  css  js  c++  java
  • google地图简单示例

    要先获取Google地图的API 密钥:http://code.google.com/intl/zh-CN/apis/maps/signup.html

    Google提供的开发文档很多

    我的代码如下

    Code
    <!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>Untitled Page</title>
        
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;sensor=false&amp;key=ABQIAAAAfhiBJ2VvezGxWN5QTnJF1hRiMmuTicfa9ZYrooSj9awNojOYohQ2gsd6YmWEocGuZPza89ghBvNpWw" type="text/javascript"></script>
    <script type="text/javascript">    
    function initialize() {      
    if (GBrowserIsCompatible()) {        
            
    var map = new GMap2(document.getElementById("map_canvas"));  
            map.setMapType(G_SATELLITE_MAP);
            
    var point = new GLatLng(30.27697,120.127296);
            map.setCenter(point, 
    17); 
            
    var marker = new GMarker(point);
            GEvent.addListener(marker,
    "click"function() {
                map.openInfoWindow(point,
    "<b>东方通信大厦!<br />我就在这上班</b>");
              });
            map.addOverlay(marker);
        }
    }    
    </script>
    </head>
    <body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style=" 500px; height: 300px"></div>
    </body>
    </html>
  • 相关阅读:
    web十二讲,CSS样式
    web第十一讲,div与span
    web第十讲,CSS基础
    git 版本回退后再恢复
    git 变更远程仓库及在本地的别名
    使用FastClick插件,无法监听双击事件
    声明式编程的没落
    gradle 很棒
    评 PowerShell
    VB 的一些歧义(不断更新)
  • 原文地址:https://www.cnblogs.com/liulun/p/1606562.html
Copyright © 2011-2022 走看看