?!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 癑ֺ地图API昄多个标注点带提示的代?/title> <!--css--> <link href="style/demo.css" rel="stylesheet" type="text/css" /> <!--javascript--> <script src="scripts/jquery-1.9.1.js" type="text/javascript"></script> <script src="scripts/demo.js" type="text/javascript"></script> <meta http-equiv="Cache-Control" content="no-transform" /> <meta http-equiv="Cache-Control" content="no-siteapp" /> </head> <body> <div style="position:fixed;left:-9000px;top:-9000px;"></div> <div class="demo_main"> <fieldset class="demo_content"> <div style="min-height: 810px; width: 100%;" id="map"> </div> <script type="text/javascript"> var markerArr = [ { title: "名称Q重庆盛大徏{材料有限公?, point: "106.57363,29.642401", address: "重庆盛大建筑材料有限公司", tel: "400-059-8158" }, ]; function map_init() { var map = new BMap.Map("map"); // 创徏Map实例 var point = new BMap.Point(106.57363,29.642401); //地图中心点,重庆? map.centerAndZoom(point, 18); // 初始化地?讄中心点坐标和地图U别? map.enableScrollWheelZoom(true); //启用滚轮攑֤~小 //向地图中d~放控g var ctrlNav = new window.BMap.NavigationControl({ anchor: BMAP_ANCHOR_TOP_LEFT, type: BMAP_NAVIGATION_CONTROL_LARGE }); map.addControl(ctrlNav); //向地图中d~略图控? var ctrlOve = new window.BMap.OverviewMapControl({ anchor: BMAP_ANCHOR_BOTTOM_RIGHT, isOpen: 1 }); map.addControl(ctrlOve); //向地图中d比例控? var ctrlSca = new window.BMap.ScaleControl({ anchor: BMAP_ANCHOR_BOTTOM_LEFT }); map.addControl(ctrlSca); var point = new Array(); //存放标注点经U信息的数组 var marker = new Array(); //存放标注点对象的数组 var info = new Array(); //存放提示信息H口对象的数l? for (var i = 0; i < markerArr.length; i++) { var p0 = markerArr[i].point.split(",")[0]; // var p1 = markerArr[i].point.split(",")[1]; //按照原数l的point格式地囄坐标的经U度分别提出? point[i] = new window.BMap.Point(p0, p1); //循环生成新的地图? marker[i] = new window.BMap.Marker(point[i]); //按照地图点坐标生成标? map.addOverlay(marker[i]); marker[i].setAnimation(BMAP_ANIMATION_BOUNCE); //跛_的动? var label = new window.BMap.Label(markerArr[i].title, { offset: new window.BMap.Size(20, -10) }); marker[i].setLabel(label); info[i] = new window.BMap.InfoWindow("<p style=’font-size:12px;lineheight:1.8em;?" + markerArr[i].title + "</br>地址Q? + markerArr[i].address + "</br> 电话Q? + markerArr[i].tel + "</br></p>"); // 创徏信息H口对象 } marker[0].addEventListener("mouseover", function () { this.openInfoWindow(info[0]); }); } //异步调用癑ֺjs function map_load() { var load = document.createElement("script"); load.src = "http://api.map.baidu.com/api?v=1.4&callback=map_init"; document.body.appendChild(load); } window.onload = map_load; </script> </fieldset> </div> <a href="http://www.wjf365.com/">һPK10-ȫ</a> <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> </html>