웹 파트를 "완성한 후"내 프로젝트의 모바일 부분을 해왔습니다. Google지도 API를 사용하고 있습니다. 다음 코드를 코딩했습니다 :Google지도 API 스크립트에 문제가 발생했습니다.
function codeAddress() {
var image = 'images/tickmark1.png';
var address = document.getElementById('address').value;
geocoder.geocode({ 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var markerZad = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
title: "NEW TASK",
icon: image
});
document.getElementById('latitude').value =results[0].geometry.location.nb.toPrecision(9);
document.getElementById('longitude').value=results[0].geometry.location.ob.toPrecision(9);
document.getElementById('adrs').value=document.getElementById('address').value;
document.getElementById('latit').value =results[0].geometry.location.nb.toPrecision(9);
document.getElementById('longit').value=results[0].geometry.location.ob.toPrecision(9);
alert("Ustalono wspolrzedne nowego zadania. Wybierz pracownika \n (PPM usuwa znacznik)");
} else {
alert('Geocode was not successful for the following reason: ' + status);
}
google.maps.event.addListener(markerZad, 'click', function() {
alert("Nowe zadanie: \n"+ address + "\n"+"Wybierz pracownika \n (PPM usuwa znacznik)");
map.setZoom(14);
map.setCenter(this.getPosition());
});
google.maps.event.addListener(markerZad, 'rightclick', function() {
markerZad.setMap(null);
document.getElementById('latitude').value =0;
document.getElementById('longitude').value=0;
document.getElementById('adrs').value=0;
document.getElementById('latit').value =0;
document.getElementById('longit').value=0;
document.getElementById('ajdideva').value="X";
document.getElementById('iddev').value=0;
document.getElementById('baton').disabled=true;
alert("Usunieto znacznik. Wpisz inny adres.");
});
});
}
이 코드의 수준을 남겨 두십시오. 나는 그것이 나쁜 것임을 확신한다. 하지만 그 일은 ... 며칠 전 같이 일하는 것이 었습니다. 이제는 그렇지 않습니다. 그리고 예, 그때 이후로 나는 그것을 만지지 않았습니다 ... 나는 문제가 "결과"를 일으킨다는 것을 알아 냈습니다. 나는 상태 == OK를 얻는다, 그리고 그것은 정확한 지점에 마커를 놓는다, 그리고, 아무 일도 일어나지 않는다. html 파일의 입력 값이 변경되지 않고 리퍼가 작동하지 않는다는 것을 의미합니다. "results [0]"을 (를) 변경했을 때 등 간단한 문자열로, 그게 효과, 그 결과에 문제가 있다고 생각하는 이유입니다 [0]. 어떤 제안을 해주시겠습니까?
:
lat()
는LatLng
-instance의 위도에 액세스 할 수 있습니다. 나는 그것이 왜 효과가 있고 지금은 그렇지 않은지에 대해 정말로 혼란 스럽다. – user2987001가능한 [Google Maps API V3 - 지오 코딩을 사용할 때만 빈지도 표시] (http://stackoverflow.com/questions/13114797/google-maps-api-v3-only-showing-a-blank-map) -when-using-the-geocder) – geocodezip