js代码
<script src="http://api.map.baidu.com/api?v=2.0&ak=EZPCgQ6zGu6hZSmXlRrUMTpr"></script> <script src="jQuery-2.1.4.min.js"></script> <script src="map.jquery.min.js"></script> <div class="bMap"></div> <script type="text/javascript"> $(function(){ $(".bMap").bMap({ address:"北京市", //默认地址,如果为空则通过解析默认坐标获取 location:[116.331398,39.897445], //默认坐标,如果为空则通过解析默认地址获取 name:"map", //提交表单的NAME,默认为map callback:function(address,point) //回调函数,返回地址数组与坐标 { console.log(address); console.log(point) } }); }) </script>