var markersArray = new Array();
function clearOverlays(){
if(markersArray){
for (i in markersArray) {
markersArray[i].setMap(null);
}
}
}
이것은 Google지도 v3 설명서에서 꽤 많이 복사되지만 ... 작동하지 않습니다. :/자바 스크립트 Google지도 V3 -이 오버레이 기능이 작동하지 않는 이유는 무엇입니까?
이 기능이 구현되는 곳이다 :
function TCGetLatLong(address){
var geo = new google.maps.Geocoder;
var lat;
var lng;
geo.geocode({'address':address},function(results, status){
if (status == google.maps.GeocoderStatus.OK) {
clearOverlays();
addMarker(results[0].geometry.location, true, true, 16, "new", 0, "", "");
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
}
이 내가 addMarker 기능에 마커를 추가 비트입니다 :
marker = new google.maps.Marker({
position: location,
draggable: draggable,
title: "Your new listing",
map: map
});
markersArray.push(marker);
google.maps.event.addListener(marker, 'dragend', function() {
infowindow.open(map,marker);
document.getElementById('lat').value = marker.position.lat();
document.getElementById('long').value = marker.position.lng();
});
google.maps.event.addListener(marker, 'dragstart', function(){ infowindow.close(); });
infowindow.open(map,marker);
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
어떤 도움이 우수 할 것입니다 .. . 고맙습니다.