地址:http://dcdc723.iteye.com/blog/689796
- 百度地图api
- 博客分类:
- 开发
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gbk" />
- <title>地图</title>
- <script type="text/javascript" src="http://api.map.baidu.com/api?key=1c9e87d6e503e41335c10add50a2d4ff&v=1.0&services=false" ></script>
- </head>
- <body>
- <div style="width:520px;height:520px;border:1px solid gray" id="container"></div>
- </body>
- </html>
- <SCRIPT LANGUAGE="JavaScript">
- var map = new BMap.Map("container");
- var point = new BMap.Point(104.023618,30.698727);//地图的经纬度坐标(经度坐标,纬度坐标)
- map.centerAndZoom(point, 17);// 初始化:point初始要定位到的点,15:地图显示级别即比例尺,值越大显示的越详细
- map.addControl(new BMap.NavigationControl({type: BMAP_NAVIGATION_CONTROL_SMALL}));
- var marker = new BMap.Marker(new BMap.Point(104.023618,30.698727));
- map.addOverlay(marker);
- marker.addEventListener("click", function(){this.openInfoWindow(infoWin);});
- var infoWinOpts = {
- width : 200
- ,height : 60
- }
- var infoWin = new BMap.InfoWindow("<div style='text-align:left;margin-top:3px;font-size:17;color:#1A6DAF'>地址:地<br>电话:028-XXXXXX</div>",infoWinOpts);//点击显示文字
- marker.openInfoWindow(infoWin);
- map.enableScrollWheelZoom(); //用鼠标滚轴
- </SCRIPT>