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
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