Tamam, kullanıcı ülkeyi seçer, daha sonra otomatik tamamlama widget'ları ile yaşadıkları bölge, şehir ve alanı seçerler. Seçtikleri değerler bir adreste birleştirilir. Google Maps API arayıp adresini işaretleyen bir Haritası'nı görüntülemek için kullanılması gerektiğini ... ... Firebug bu durum alıyorum Maalesef bu çalışmıyor:Seçilen adresi gösteren bir google haritaları görüntüleme
yakalanmamış istisna: [istisna. nsresult: "0x80004005 (N: .. " 0x80004005 (NS_ERROR_FAILURE) [nsIDOMViewCSS.getComputedStyle] Bileşeni döndürülen hata kodu" S_ERROR_FAILURE)" konum: "JS çerçeve :: http://maps.gstatic.com/intl/en_us/mapfiles/api-3/4/11a/main.js :: Xk :: hat 55" veriler: no]
İşte
benim kod:
bu src="http://maps.google.com/maps/api/js?sensor=false"
var address = selectedArea + ', ' + selectedCity + ', ' + selectedDistrict + ', Lebanon';
var geocoder = new google.maps.Geocoder();
geocoder.geocode({ 'address': address }, function (results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var map = new google.maps.Map($("#addressMap"));
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
} else {
alert("Geocode was not successful for the following reason: " + status);
}
});
ile bir komut dosyası etiketi
Peki neler oluyor?
Mükemmel:
İşte son kodudur! Tam istediğim şekilde çalıştım! Teşekkür ederim :) – Kassem
Ben document.getElementById ('addressMap') $ ('div # addressMap') eşdeğerdir izlenim altında idi. Açıkça değil. Bana yardım ettiğin için teşekkürler. –
@AdamWaite 'document.getElementById()' bir DOM nesnesini döndürür, '$()' jQuery nesnesini döndürür. –