HelloWorld ——显示以大连星海广场为中心的600*600的地图网页【GMap学习笔记】

 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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值