zoukankan      html  css  js  c++  java
  • 获取用户当前位置并设为中心点

    // 获取用户当前位置
    var geolocation = new BMap.Geolocation();
    geolocation.getCurrentPosition(function(r){
    	if(this.getStatus() == BMAP_STATUS_SUCCESS){
    		var mk = new BMap.Marker(r.point);
    		map.addOverlay(mk);
    		map.panTo(r.point);
    		alert('您的位置:'+r.point.lng+','+r.point.lat);
    	}
    	else {
    		alert('failed'+this.getStatus());
    	}        
    });
    

      

  • 相关阅读:
    poj3255,poj2449
    poj2186
    poj3249
    poj3378
    poj3274
    poj1948
    hdu 2181暴搜
    hdu 3342
    hdu 1285
    hdu 1598
  • 原文地址:https://www.cnblogs.com/xhrr/p/11640818.html
Copyright © 2011-2022 走看看