腾讯地图拾取坐标
Posted zyip
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了腾讯地图拾取坐标相关的知识,希望对你有一定的参考价值。
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/> <title>点击地图事件</title> <style type="text/css"> *{ margin:0px; padding:0px; } body, button, input, select, textarea { font: 12px/16px Verdana, Helvetica, Arial, sans-serif; } p{ width:603px; padding-top:3px; overflow:hidden; } #container { min-width:603px; min-height:767px; } </style> <script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp"></script> <script> var markersArray=[]; var init = function() { var map = new qq.maps.Map(document.getElementById("container"),{ center: new qq.maps.LatLng(39.916527,116.397128), zoom: 13, }); //添加监听事件 qq.maps.event.addListener(map, ‘click‘, function(data) { for (i in markersArray) { markersArray[i].setMap(null); } var anchor = new qq.maps.Point(6, 6), size = new qq.maps.Size(24, 24), origin = new qq.maps.Point(0, 0), var marker = new qq.maps.Marker({ map: map, position:data.latLng}); markersArray.push(marker); setTimeout(function(){ alert(data.latLng); },200); }); } </script> </head> <body onload="init()"> <div id="container"></div> </body> </html>
以上是关于腾讯地图拾取坐标的主要内容,如果未能解决你的问题,请参考以下文章