<script type="text/javascript"> // 百度地图API功能 var map = new BMap.Map("allmap"); // 创建Map实例 var point = new BMap.Point(121.338403, 31.24203); map.centerAndZoom(point, 7);//创建中心点 map.enableScrollWheelZoom(); //启用滚轮放大缩小,默认禁用 map.enableContinuousZoom(); //启用地图惯性拖拽,默认禁用 var data = [[115.394142,32.460954,"111111"],[121.338403, 31.24203,"22222"],[119.588726,28.478101,"33333"]]; $.each(data,function(idx, obj) { var marker = new BMap.Marker(new BMap.Point(obj[0], obj[1])); // 创建点 map.addOverlay(marker); //增加点 marker.setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画 var infoWindow = new BMap.InfoWindow(obj[2]); // 创建信息窗口对象 marker.addEventListener("click", function(){ //给标注添加点击事件 this.openInfoWindow(infoWindow); }); }) myGeo = new BMap.Geocoder(); </script>
原文:http://www.cnblogs.com/fdht/p/5200145.html