标签:点击 iso blank 自己 百度 content web开发 over poi
概述
读者在使用百度地图API之前,需要申请一个密钥,读者可以点击这里阅读百度地图JavaScript API的详细教程。
百度地图JavaScript API语法
web开发的语法就是javaScript。
javaScript 类参考
点击我阅读JavaScript 类参考。
一个简单的地图Demo
<!DOCTYPE html> <html> <head> <title>demo</title> <meta name="content-type" content="text/html; charset=UTF-8"> <!-- In order to better support the mobile terminal --> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <!-- reference baidu map api js --> <script src="http://api.map.baidu.com/api?v=2.0&ak=UfuZjklxjf6BmZvIIdW9c5hjDGvtO9bw"></script> </head> <body> <!-- must set width and height --> <div id="container" style="width:70%;height:400px"></div> <script> //create map var map=new BMap.Map("container"); //initialize map var point1=new BMap.Point(104.074091,30.665783); map.centerAndZoom(point1,12); //add marker on map var point2=new BMap.Point(104.158603,30.642172); var marker=new BMap.Marker(point2); map.addOverlay(marker); //addPanoramaConverageLayer on map var pclyer=new BMap.PanoramaCoverageLayer(); map.addTileLayer(pclyer); //add panoramaControl on map var pnrm=new BMap.PanoramaControl(); map.addControl(pnrm); //add overviewControl on map var overviewControl = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:true}); map.addControl(overviewControl); </script> </body> </html>
总结:
map.addEventListener("click",function(e){
console.log(e.point.lng+","+e.point.lat);
});
标签:点击 iso blank 自己 百度 content web开发 over poi
原文地址:http://www.cnblogs.com/HDK2016/p/6200447.html