高德地图-控件
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>控件</title> 6 <script type="text/javascript"> 7 function init() { 8 var d = new Date(); 9 var map = new AMap.Map(mapDiv, { 10 view:new AMap.View2D({ 11 center: new AMap.LngLat(116.39, 39.9), 12 zoom:15 13 }) 14 }); 15 map.plugin(["AMap.ToolBar","AMap.OverView","AMap.Scale"],function(){ 16 //加载工具条 17 tool = new AMap.ToolBar({ 18 direction:true,//隐藏方向导航 19 ruler:true,//隐藏视野级别控制尺 20 autoPosition:true//禁止自动定位 21 }); 22 23 map.addControl(tool); 24 //移除工具条 25 //map.removeControl(tool); 26 //加载鹰眼 27 view = new AMap.OverView(); 28 map.addControl(view); 29 //加载比例尺 30 31 scale = new AMap.Scale(); 32 map.addControl(scale); 33 34 //--------圆实例-------------------- 35 //初始化待编辑的圆实例 36 var circle = new AMap.Circle({ 37 map: map, 38 center:new AMap.LngLat("116.40332221984863","39.90025505675715"), 39 radius:1000 40 }); 41 //加载圆编辑插件 42 map.plugin(["AMap.CircleEditor"],function(){ 43 //实例化时指定地图对象 44 circleEditor = new AMap.CircleEditor(map,circle); 45 }); 46 47 }); 48 } 49 function loadScript() { 50 var script = document.createElement("script"); 51 script.type = "text/javascript"; 52 script.src = "http://webapi.amap.com/maps?v=1.3&key=973ff4275eaf1fb1ba1292a967ba116b&callback=init"; 53 document.body.appendChild(script); 54 } 55 window.onload = loadScript; 56 </script> 57 </head> 58 <body> 59 <input type="button" value="aaa"/> 60 <div id="mapDiv" style="width:800px; height:600px"></div> 61 62 </body> 63 </html>