<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>百度地图</title>
</head>
<body>
<div style=" width:500px; height:500px;" id="baiduMapDiv"></div>
</body>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>
<script type="text/javascript">
var map = new BMap.Map("baiduMapDiv");
var myGeo = new BMap.Geocoder();
myGeo.getPoint("华山", function(point){
if (point) {
map.centerAndZoom(point, 17);
map.addOverlay(new BMap.Marker(point));
addMapControl();
}
}, "渭南市");
function addMapControl(){
map.enableDragging();
map.enableScrollWheelZoom();
map.enableDoubleClickZoom();
var ctrl_nav = new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_LARGE});
map.addControl(ctrl_nav);
var ctrl_sca = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT});
map.addControl(ctrl_sca);
}
</script>
</html>
百度地图实例
最新推荐文章于 2023-06-19 19:06:58 发布