<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>百度地图</title> <script type="text/javascript"> function initialize() { var map = new BMap.Map("allmap",{minZoom:12,maxZoom:20}); // 创建Map实例 //map.centerAndZoom(new BMap.Point(116.4035,39.915),15); //初始化时,即可设置中心点和地图缩放级别。 map.centerAndZoom("成都",13); // 初始化地图,设置中心点坐标和地图级别。 map.enableScrollWheelZoom(true);//鼠标滑动轮子可以滚动 } function loadScript() { var script = document.createElement("script"); script.src = "http://api.map.baidu.com/api?v=1.4&callback=initialize"; document.body.appendChild(script); } window.onload = loadScript; </script> </head> <body> <div style="float:left;width:100px;">1</div> <div id="allmap" style="width: 800px; height: 500px"></div> </body> </html> <script type="text/javascript"> // 移动到某点 map.panTo(new BMap.Point(116.409, 39.918)); </script>
时间: 2024-11-05 13:48:52