我添加了一个标记到谷歌地图与10.531294,76.214121的坐标,我有一个叠加点击事件。我需要得到像10.531294,76.214121这样的坐标。但它显示了不同的一个,如10.531294,76.21412099999998。
如何通过javascript修复此问题以获得10.531294,76.214121?
这是我的代码
var map;
var markers = [];
function initialize() {
var haightAshbury = new google.maps.LatLng(10.531294, 76.214121);
var mapOptions = {
zoom: 12,
center: haightAshbury,
mapTypeId: google.maps.MapTypeId.TERRAIN
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
google.maps.event.addListener(map, 'click', function(event) {
alert(event.latLng);
});
mymarker = new google.maps.LatLng(10.531294, 76.214121);
addMarker(mymarker);
}
function addMarker(location) {
var marker = new google.maps.Marker({
position: location,
map: map
});
markers.push(marker);
}
function setAllMap(map) {
for (var i = 0; i < markers.length; i++) {
markers[i].setMap(map);
}
}
function clearOverlays() {
setAllMap(null);
}
function showOverlays() {
setAllMap(map);
}
function deleteOverlays() {
clearOverlays();
markers = [];
}
google.maps.event.addDomListener(window, 'load', initialize);
请帮帮我