1 <!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN"
 2    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 3 <html xmlns="http://www.w3.org/1999/xhtml">
 4  <head>
 5    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
 6    <title>Google Maps JavaScript API Example</title>
 7    <!--使用 script 标签包含 Google 地图,key传递 sensor 参数以指明此应用程序是否使用传感器来确定用户位置-->
 8    <script src="http://ditu.google.cn/maps?file=api&amp;v=2&amp;key=abcdefg&sensor=true_or_false"
 9            type="text/javascript"></script>
10     <script type="text/javascript">
11 
12    function initialize() {
13      if (GBrowserIsCompatible()) {
14        var map= new GMap2(document.getElementById("map_canvas"));
15        //GLatLng(纬度(Latitude),经度(Longitude))
16        //初始化地图,setCenter(GLatLng坐标,缩放级别)
17         map.setCenter(new GLatLng(38.881946,121.587964), 15);
18      }
19    }
20 
21    </script>
22  </head>
23  <!--使用onLoad 事件初始化地图对象 GUnload函数是防止内存泄露的实用工具函数-->
24  <body onload="initialize()" onunload="GUnload()">
25  <!--让其显示在网页中-->
26    <div id="map_canvas" style="width: 600px; height: 600px"></div>
27  </body>
28 </html>
29 
posted on 2010-04-03 20:48 Ying-er 阅读(293) 评论(0)  编辑  收藏 所属分类: Google Map

只有注册用户登录后才能发表评论。


网站导航: