<!-- 地图 -->
<script type="text/javascript">
//百度地图API功能
function loadJScript() {
var script = document.createElement("script");
script.type = "text/javascript";
script.src = "http://api.map.baidu.com/api?v=2.0&ak=EcXeADk24QxZVfxGSG7jS2V40s0f13h7&callback=init";
document.body.appendChild(script);
}
function init() {
var map = new BMap.Map("map"); // 创建地图实例
var point = new BMap.Point(100.746294, 13.614046); // 创建点坐标
map.centerAndZoom(point, 11); // 初始化地图,设置中心点坐标和地图级别
map.enableScrollWheelZoom(true); //开启缩放
map.enableDragging(); //开启拖拽
map.addEventListener("rightclick", function (e) {
map.clearOverlays();//添加标注前清空以前的所有标注
layer.msg(e.point.lng + ", " + e.point.lat,{icon:1});
$("#longitude").val(e.point.lng);
$("#dimension").val(e.point.lat);
var marker = new BMap.Marker(new BMap.Point(e.point.lng, e.point.lat)); // 创建标注
map.addOverlay(marker);
});
}
window.onload = loadJScript; //异步加载地图
</script>