天天看点

百度地图获取某个城市的经度纬度

<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>?峰????涓???甯???缁?搴?含搴?lt;/title> <script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script> </head> <body> <div style="width:520px;height:340px;border:1px solid gray" id="container"></div> </body> </html> <script type="text/javascript"> var map = new BMap.Map("container"); // ??寤?ap瀹?渚? map.centerAndZoom("????,12); // ??濮????板??璁剧疆??甯????板?剧骇???? setTimeout(function(){ ?var jw=map.getCenter(); ?alert('缁?搴?'+jw.lng+"\n绾?搴?"+jw.lat); },10000)</script>

??涓虹?惧害?板?剧?????? ??濮????板?炬?堕?介??瑕?涓?涓?缁?搴???绾?搴?浣?娌℃?????版??涔???寰?涓?涓???甯?缁?搴?含搴????规?,灏卞?浜?寮?

杞?杞戒?:https://www.cnblogs.com/Iamlein/archive/2011/09/15/2375904.html

继续阅读