huaqiqi

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>获取某个城市的经纬度</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");            // 创建Map实例

map.centerAndZoom("西安",17);                   // 初始化地图 设置城市和地图级别。

setTimeout(function(){

 var jw=map.getCenter();  

alert(\'经度:\'+jw.lng+"\n纬度:"+jw.lat); },10000)

</script>

分类:

技术点:

相关文章:

  • 2021-11-08
  • 2021-12-10
  • 2021-09-20
  • 2021-11-14
  • 2021-12-04
  • 2021-12-06
  • 2021-09-21
猜你喜欢
  • 2021-12-17
  • 2022-02-08
  • 2021-11-17
  • 2021-11-17
  • 2021-12-04
  • 2021-06-09
相关资源
相似解决方案