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&v=2&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 閱讀(307)
評論(0) 編輯 收藏 所屬分類:
Google Map