詳細(xì)地址:廣東省深圳市龍崗區(qū)愛南路78號利好工業(yè)園13棟3、4樓"; var cp_lng=114.294183; var cp_lat=22.71831; //創(chuàng)建和初始化地圖函數(shù): function initMap(){ createMap();//創(chuàng)建地圖 setMapEvent();//設(shè)置地圖事件 addMapControl();//向地圖添加控件 addMapOverlay();//向地圖添加覆蓋物 } function createMap(){ map = new BMap.Map("map"); map.centerAndZoom(new BMap.Point(cp_lng,cp_lat),15); //縮放比例[19級,18級,17級,16級,15級,14級,13級,12級,11級,10級,9級,8級,7級,6級,5級,4級,3級,2級,1級] } function setMapEvent(){ map.enableScrollWheelZoom(); map.enableKeyboard(); map.enableDragging(); map.enableDoubleClickZoom() } function addClickHandler(target,window){ target.addEventListener("click",function(){ target.openInfoWindow(window); }); } function addMapOverlay(){ var markers = [ {content:cp_content,title:cp_title,imageOffset: {width:-46,height:-21},position:{lat:cp_lat,lng:cp_lng}} ]; for(var index = 0; index < markers.length; index++ ){ var point = new BMap.Point(markers[index].position.lng,markers[index].position.lat); var marker = new BMap.Marker(point,{icon:new BMap.Icon("http://api.map.baidu.com/lbsapi/createmap/images/icon.png",new BMap.Size(20,25),{ imageOffset: new BMap.Size(markers[index].imageOffset.width,markers[index].imageOffset.height) })}); var label = new BMap.Label(markers[index].title,{offset: new BMap.Size(25,5)}); var opts = { width: 200, title: markers[index].title, enableMessage: false }; var infoWindow = new BMap.InfoWindow(markers[index].content,opts);// 創(chuàng)建信息窗口對象 marker.setLabel(label); addClickHandler(marker,infoWindow); map.addOverlay(marker); map.openInfoWindow(infoWindow, map.getCenter()); // 打開信息窗口 }; } //向地圖添加控件 function addMapControl(){ var scaleControl = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT}); scaleControl.setUnit(BMAP_UNIT_IMPERIAL); map.addControl(scaleControl); var navControl = new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_LARGE}); map.addControl(navControl); var overviewControl = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:true}); map.addControl(overviewControl); } var map; initMap();