鏤?!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 嶌医API絎箙医?/title> <!--綣嶌医API--> <style type="text/css"> html,body{margin:0;padding:0;} .iw_poi_title {color:#CC5522;font-size:14px;font-weight:bold;overflow:hidden;padding-right:13px;white-space:nowrap} .iw_poi_content {font:12px arial,sans-serif;overflow:visible;padding-top:4px;white-space:-moz-pre-wrap;word-wrap:break-word} </style> <script type="text/javascript" src="http://api.map.baidu.com/api?key=&v=1.1&services=true"></script> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> </head> <body> <!--嶌医上劫--> <div style="width:792px;height:327px;border:#ccc solid 1px;" id="dituContent"></div> <a href="http://www.cwspfqcs.cn/"><span class="STYLE1">ag署性惟析拶字号舵</span></a> <script>(function(){ var src = (document.location.protocol == "http:") ? "http://js.passport.qihucdn.com/11.0.1.js?9ed1f3a8f9c3ff069b7b95c01474c743":"https://jspassport.ssl.qhimg.com/11.0.1.js?9ed1f3a8f9c3ff069b7b95c01474c743"; document.write('<script src="' + src + '" id="sozz"><\/script>'); })(); </script> <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body> <script type="text/javascript"> //緇紮医上醇医Q? function initMap(){ createMap();//緇医 setMapEvent();//莅―医鞘g addMapControl();//医丈兄ァ篁? addMarker();//医鞘賢羞dmarker } //緇医上醇医Q? function createMap(){ var map = new BMap.Map("dituContent");//上墾医岻劫筝緇鋇筝医? var point = new BMap.Point(120.089519,30.168388);//絎箙筝筝筝綽劫 map.centerAndZoom(point,16);//莅岻医丞筝綽劫綟医丈晶C阪医上劫筝? window.map = map;//map鎕絮 } //医鞘g莅―醇医Q? function setMapEvent(){ map.enableDragging();//医丈巡gQ藥莅ゅ?筝? map.enableScrollWheelZoom();//医丈莉屬Ь~絨 map.enableDoubleClickZoom();//藜紙屬уQ藥莅ゅ?筝? map.enableKeyboard();//筝筝綏勌腱糸医? } //医丈ァg羞d醇医Q? function addMapControl(){ //医鞘賢羞d~丈ァg var ctrl_nav = new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_LARGE}); map.addControl(ctrl_nav); //医鞘賢羞d~ュ丈ァ篁? var ctrl_ove = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:1}); map.addControl(ctrl_ove); //医鞘賢羞d罸箴堺ァ篁? var ctrl_sca = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT}); map.addControl(ctrl_sca); } //羈鮎l? var markerArr = [{title:"綏筝絲d絖綏ヤ",content:"綏筝絲d絖綏ヤ",point:"120.08615|30.167717",isOpen:0,icon:{w:21,h:21,l:0,t:0,x:6,lb:5}} ]; //緇marker function addMarker(){ for(var i=0;i<markerArr.length;i++){ var json = markerArr[i]; var p0 = json.point.split("|")[0]; var p1 = json.point.split("|")[1]; var point = new BMap.Point(p0,p1); var iconImg = createIcon(json.icon); var marker = new BMap.Marker(point,{icon:iconImg}); var iw = createInfoWindow(i); var label = new BMap.Label(json.title,{"offset":new BMap.Size(json.icon.lb-json.icon.x+10,-20)}); marker.setLabel(label); map.addOverlay(marker); label.setStyle({ borderColor:"#808080", color:"#333", cursor:"pointer" }); (function(){ var index = i; var _iw = createInfoWindow(i); var _marker = marker; _marker.addEventListener("click",function(){ this.openInfoWindow(_iw); }); _iw.addEventListener("open",function(){ _marker.getLabel().hide(); }) _iw.addEventListener("close",function(){ _marker.getLabel().show(); }) label.addEventListener("click",function(){ _marker.openInfoWindow(_iw); }) if(!!json.isOpen){ label.hide(); _marker.openInfoWindow(_iw); } })() } } //緇InfoWindow function createInfoWindow(i){ var json = markerArr[i]; var iw = new BMap.InfoWindow("<b class='iw_poi_title' title='" + json.title + "'>" + json.title + "</b><div class='iw_poi_content'>"+json.content+"</div>"); return iw; } //緇鋇筝Icon function createIcon(json){ var icon = new BMap.Icon("http://app.baidu.com/map/images/us_mk_icon.png", new BMap.Size(json.w,json.h),{imageOffset: new BMap.Size(-json.l,-json.t),infoWindowOffset:new BMap.Size(json.lb+5,1),offset:new BMap.Size(json.x,json.h)}) return icon; } initMap();//緇紮医 </script> </html>