<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <meta name="Keywords" content="" /> <meta name="Description" content="" /> <style type="text/css"> body{ margin:0;padding:0;font-family:Arial,Times New Roman, serif} p{ margin:0;padding:0} html,body{ width:100%; height:100%; } #map_container{ height:100%;} @media print{ #notes{ display:none} #map_container{ margin:0} } /*]]>*/</style> </head> <body> <div id="map_container"></div> <script type="text/javascript" src="https://webapi.amap.com/maps?v=1.3&key=5563708237748adfbceced14e8cef9c5"></script> <script type="text/javascript"> //初始化地图对象,加载地图 var map = new AMap.Map("map_container", { resizeEnable: true, lang:"en", //二维地图显示视口 view: new AMap.View2D({ center: new AMap.LngLat(113.78933,22.731031), //地图中心点 zoom: 13 //地图显示的缩放级别 }) }); //地图中添加地图操作ToolBar插件 map.plugin(["AMap.ToolBar"], function () { var toolBar = new AMap.ToolBar(); map.addControl(toolBar); }); //创建信息窗体 var info = []; info.push("<div style=\"padding:0px 0px 0px 4px;\"><b>S-HANDE</b>"); info.push("Tel:+86 ******"); info.push("Address:************"); var marker = new AMap.Marker({ map:map, position: new AMap.LngLat(113.78933,22.731031), //基点位置 offset: new AMap.Pixel(-10,-20), //相对于基点的偏移位置 draggable: false, //是否可拖动 }); marker.setMap(map); //在地图上添加点 var infoWindow = new AMap.InfoWindow({ content: info.join("<br/>") }); infoWindow.open(map, new AMap.LngLat(113.78933,22.731031)); //在地图上打开信息窗体 </script> </body> </html>
标签: