Gets the user's current location and set the center point

 

// Get the user's current position 
var Geolocation new new BMap.Geolocation = (); 
geolocation.getCurrentPosition (function (R & lt) { 
	IF (this.getStatus () == BMAP_STATUS_SUCCESS) { 
		var new new BMap.Marker MK = (r.point); 
		the Map.addOverlay (MK); 
		map.panTo (r.point); 
		Alert ( 'location:' + r.point.lng + ',' + r.point.lat); 
	} 
	the else { 
		Alert ( 'failed' + this.getStatus ()); 
	}         
});

  

Guess you like

Origin www.cnblogs.com/xhrr/p/11640818.html