gpt4 book ai didi

javascript - Google Map API v3 无法在 IE9 中加载

转载 作者:数据小太阳 更新时间:2023-10-29 05:26:34 26 4
gpt4 key购买 nike

我尽可能多地研究了这个主题,但没有找到解决方案。

在除 Internet Explorer(版本 8 或 9)之外的所有浏览器中,下面的脚本都可用于加载 Google map 。但是,在 IE8IE9 中,Google map API (v3) 似乎无法加载。我曾在控制台中查找特定错误,但一无所获。

HTML

<style type="text/css">
#map_canvas {
height: 292;
width:980
}

.contactus-Captcha {
clear:both;
}
</style>

<div id="map_canvas"></div>

Javascript

function initialize() {
var homeLatlng = new google.maps.LatLng(29.70280,-95.51731);

var myOptions = {
zoom: 15,
center: homeLatlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};

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


var contentString = '<div id="content">'+
'<div id="siteNotice">'+
'</div>'+
'<h3>ABC</h3>'+
'<div id="bodyContent">'+
'<div class="AddressWrap"><div style="width:100%; margin:1 auto; float:left;"><img src="<?php echo ROOTPATH; ?>images/location-icon.png" style="float:left; padding-right:5px;"> <h3 class="Marker"> xyz</h3></div><h3 class="Mobile"> <img src="<?php echo ROOTPATH; ?>images/mob-icon2.png" style="float:left; padding-right:12px; "> 123445</h3></div>'+
'</div>'+
'</div>';
var infowindow = new google.maps.InfoWindow({
content: contentString
});

var image = new google.maps.MarkerImage(
'<?php echo ROOTPATH; ?>images/addres-icon.png',
new google.maps.Size(32, 32), // size
new google.maps.Point(0,0), // origin
new google.maps.Point(16, 32) // anchor
);

var shadow = new google.maps.MarkerImage(
'http://maps.google.com/mapfiles/ms/micons/msmarker.shadow.png',
new google.maps.Size(59, 32), // size
new google.maps.Point(0,0), // origin
new google.maps.Point(16, 32) // anchor
);

var homeMarker = new google.maps.Marker({
position: homeLatlng,
map: map,
title: "xyz",
icon: image,
shadow: shadow
});
google.maps.event.addListener(homeMarker, 'click', function() {
infowindow.open(map,homeMarker);
});
}

$(document).ready(function() {
initialize(); //Calling on load
});

谁能帮帮我?我将不胜感激!

最佳答案

您的 map 没有尺寸。变化:

#map_canvas { height: 292; width:980 }

收件人:

#map_canvas { height: 292px; width:980px }

关于javascript - Google Map API v3 无法在 IE9 中加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16939748/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com