0
我有一個谷歌地圖,從文件中拉出地址值並繪製它們。它在IE中正常工作即。地圖顯示正常,標記正在顯示。然而,在Chrome和Firefox中,只有地圖顯示出來,但不顯示標記..我不明白它..因爲標記沒有顯示,所以infowindow也沒有工作。雖然我沒有在這裏包含inforwindow代碼!谷歌地圖標記顯示在IE中,但不是鉻或火狐
var geocoder;
var map;
function initializeMap() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(39.88445,-86.11084);
var myOptions = {
zoom: 9,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
function codeAddress() {
var infowindow = new google.maps.InfoWindow({});
$('span.LocationAddress').each(function(index) {
var addy = $(this).text();
geocoder.geocode({ 'address': addy}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
title:addy
});
}
});
});
}
你會在螢火蟲中發現任何錯誤嗎?你能夠建立一個鏈接? – atmd 2012-01-13 14:21:41
如何檢查螢火蟲中的錯誤?地圖顯示正常。它只是不繪製標記..因此,codeaddress()函數正在發生。請幫助! :( – 2012-01-13 14:25:38
嘗試顛倒屬性的順序:第一個位置,第二個地圖。這沒有多少意義,但... – 2012-01-13 14:34:30