码迷,mamicode.com
首页 > 其他好文 > 详细

腾讯地图拾取坐标

时间:2016-05-28 07:49:11      阅读:3484      评论:0      收藏:0      [点我收藏+]

标签:

 

<!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>

 

腾讯地图拾取坐标

标签:

原文地址:http://www.cnblogs.com/zyip/p/5536716.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!