百度地图 标示,根据坐标
From:http://www.goocar.cn/maintenance.html
<style type="text/css">
div.BMap_bubble_content {color:#333; padding-right:10px;}
div.BMap_bubble_content a {color:#2079dd;}
</style>
<script type="text/javascript" src="http://www.goocar.cn/templates/dev/js/sh.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.3"></script>
<script type="text/javascript">
var objMap = null;
$(document).ready(function() {
objMap = new BMap.Map("id_map");
objMap.centerAndZoom("上海", 12);
objMap.addControl(new BMap.NavigationControl());
var jsonData = {"t":"all","a":0,"k":""};
$.post('http://www.goocar.cn/ws/get_list_on_map.html', jsonData, function(re) {
var i = 0;
var j = re.length;
for (i = 0; i < j; i ++) {
var marker = new BMap.Marker(new BMap.Point(re[i].lng, re[i].lat));
objMap.addOverlay(marker);
addInfoEvent(marker, re[i]);
}
}, "json");
});
function addInfoEvent(marker, info) {
var strHtml = '<b>' + info.name + '</b><br />地址: ' + info.addr + '<br />电话: ' + info.tel + '<br /><a target="_blank" href="' + info.url + '">查看详情»</a>';
var objWindow = new BMap.InfoWindow(strHtml);
marker.addEventListener("mouseover", function() {
marker.openInfoWindow(objWindow);
});
marker.addEventListener("mouseout", function() {
setTimeout(function(){marker.closeInfoWindow()}, 3000);
});
}
</script>
posted on 2012-11-05 16:55 canny_strive 阅读(192) 评论(0) 编辑 收藏 举报