0

会社のポートフォリオを表示する Google マップ アプリケーションを作成しました。奇妙なことに、私のマーカーは ie8 でのみ表示されます。誰にも解決策がありますか?これはJavaScriptコードです。

var map;
    function initialize() { 
        var myOptions = {
        zoom: 6,
        mapTypeId: google.maps.MapTypeId.ROADMAP

[arrays with data]

var infoWindow = new google.maps.InfoWindow;
    map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);

    // Set the center of the map
    var pos = new google.maps.LatLng(50.941641437268906, 9.088932512500037);
    map.setCenter(pos);
    function infoCallback(infowindow, marker) { 
        return function() {
        infowindow.open(map, marker);
    };





function setMarkers(map, all) { 
for (var i in all) {
var adres               = all[i][0];
var name                = all[i][1];                                        
var property            = all[i][2];
var office              = all[i][3];
var warehouse           = all[i][4];
var other               = all[i][5];
var total               = all[i][6];
var parkingspaces               = all[i][7];
var yearOfConstruction          = all[i][8];
var lat                 = all[i][9];
var lng                 = all[i][10];
var latlngset;
latlngset = new google.maps.LatLng(lat, lng);
var marker = new google.maps.Marker({  
map: map,  title: adres,  position: latlngset, icon: image  
        });


        var image = 'images/pandklein.png';
        var content = '<div id=content>' +'<img class="thumpnail" src="thumpnail/' + name + '.png" alt ="' + name + '">' + '<div class="map-content"><h3 class="title">' + adres + '</h3>' +
         'Lettable floor area (m&#178;):' + "<p class='tekst'>" + total + "</p>" +  '<br />' + 'Property:' + ' ' + "<p class='tekst'>" + property + "</p>" +
             '<br />' + 'Year of construction:' + ' ' + "<p class='tekst'>" + yearOfConstruction + "</p>" + '</div>';               
        var infowindow = new google.maps.InfoWindow();
          infowindow.setContent(content);
          google.maps.event.addListener(
            marker, 
            'click', 
            infoCallback(infowindow, marker)
          );
      }
    }           
    // Set all markers in the all variable
    setMarkers(map, all);
  };
  // Initializes the Google Map
  google.maps.event.addDomListener(window, 'load', initialize);
4

1 に答える 1

0

あなたの問題を再現しようとして、次の html を書きましたが、マーカーは IE8 で表示されます。したがって、ここに投稿されたコードには、(おそらく) 何が問題なのかが欠けていると思います。

<!DOCTYPE html>
<html>
<head>
<script src="http://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript" charset="UTF-8"></script>
</head>
<body>
<div id="map_canvas" style="width:400px;height:400px;">
</div>
<script type="text/javascript">
var map;
function initialize() { 
    var myOptions = {
        zoom: 6,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };

    var infoWindow = new google.maps.InfoWindow;
    map = new google.maps.Map(document.getElementById('map_canvas'), myOptions);

    // Set the center of the map
    var pos = new google.maps.LatLng(50.941641437268906, 9.088932512500037);
    map.setCenter(pos);

    function infoCallback(infowindow, marker) { 
        return function() {
            infowindow.open(map, marker);
        };
    }

    function setMarkers(map, all) { 
        for (var i in all) {
            var adres               = all[i][0];
            var name                = all[i][1];
            var property            = all[i][2];
            var office              = all[i][3];
            var warehouse           = all[i][4];
            var other               = all[i][5];
            var total               = all[i][6];
            var parkingspaces       = all[i][7];
            var yearOfConstruction  = all[i][8];
            var lat                 = all[i][9];
            var lng                 = all[i][10];
            var latlngset;

            latlngset = new google.maps.LatLng(lat, lng);
            var marker = new google.maps.Marker({map: map,  title: adres,  position: latlngset}); //icon: image});
            //var image = 'images/pandklein.png'; // why declared here?
            var content = '<div id=content>' +'<img class="thumpnail" src="thumpnail/' + name + '.png" alt ="' + name + '">' + '<div class="map-content"><h3 class="title">' + adres + '</h3>' +
            'Lettable floor area (m&#178;):' + "<p class='tekst'>" + total + "</p>" +  '<br />' + 'Property:' + ' ' + "<p class='tekst'>" + property + "</p>" +
            '<br />' + 'Year of construction:' + ' ' + "<p class='tekst'>" + yearOfConstruction + "</p>" + '</div>';
            var infowindow = new google.maps.InfoWindow();
            infowindow.setContent(content);
            google.maps.event.addListener(marker, 'click', infoCallback(infowindow, marker));
        }
    }           

    var all = [["", "", "", "", "", "", "", "", "", 51, 9]];    

    // Set all markers in the all variable
    setMarkers(map, all);
}

// Initializes the Google Map
google.maps.event.addDomListener(window, 'load', initialize());
</script>
</body>
</html>
于 2013-09-29T11:05:36.313 に答える