Internet Explorer中的Google Maps呈现显示灰色框

时间:2012-10-01 03:39:31

标签: javascript html css internet-explorer google-maps

我正在处理一个显示一些标记的简单地图。代码似乎在Chrome和Firefox中运行良好,但不会在IE中呈现。以下是运行代码时获得的图片:http://imageshack.us/photo/my-images/833/iemapgrey.png/

没有javascript错误,至少在IE调试控制台中没有。这是代码:

 <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key={{=GOOGLEMAP_KEY}}" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function load() {
  if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map"));
    map.addControl(new GSmallMapControl());
    map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(-34.885931,-66.093750), 1);
    map.setZoom(map.getZoom()+5);
    map.enableScrollWheelZoom();
    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    var baseIcon = new GIcon();
    baseIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    baseIcon.iconSize = new GSize(20, 34);
    baseIcon.shadowSize = new GSize(37, 34);
    baseIcon.iconAnchor = new GPoint(9, 34);
    baseIcon.infoWindowAnchor = new GPoint(9, 2);
    baseIcon.infoShadowAnchor = new GPoint(18, 14);
    var blueIcon = new GIcon();
    blueIcon.image = "http://www.google.com/intl/en_us/mapfiles/ms/micons/blue-dot.png";
    blueIcon.shadow = "http://www.google.com/mapfiles/shadow50.png";
    blueIcon.iconSize = new GSize(37, 34);
    blueIcon.shadowSize = new GSize(37, 34);
    blueIcon.iconAnchor = new GPoint(9, 34);
    blueIcon.infoWindowAnchor = new GPoint(9, 2);
    blueIcon.infoShadowAnchor = new GPoint(18, 14);

    function createMarker(point, i, message) {
       // Set up our GMarkerOptions object
       if(i==0) markerOptions = { icon:blueIcon };
       else markerOptions= {}
       var marker = new GMarker(point, markerOptions);
       GEvent.addListener(marker, "click", function() {
         marker.openInfoWindowHtml(message);
       });
       return marker;
    }
    {{for row in sites:}}{{if row.latitude and row.longitude:}}
      var point = new GLatLng({{=row.latitude}},{{=row.longitude}});
      map.addOverlay(createMarker(point, 0, 'Direccion: {{=row.adress}}, Operador: {{=row.owner}} <br> <a href="site/{{=row.legacy_site_id}}">Ver Sitio</a>'));
    {{pass}}{{pass}}
 }
}
//]]>
</script>

感谢您的帮助!!

0 个答案:

没有答案