【发布时间】:2011-06-07 19:05:53
【问题描述】:
我尝试使用谷歌地图,它适用于 Chrome IE 但不适用于 FireFox?
我想念一些东西:
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/jscript">
function initialize() {
var latitude = document.getElementById("Latitude").value;
var longitude = document.getElementById("Longitude").value;
var latlng = new google.maps.LatLng(latitude, longitude);
var options = { zoom: 16, center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById
("map_canvas"), options);
var image = '@Url.Content("~/Images/pushpin.png")';
var marker = new google.maps.Marker({
position: latlng,
title: "Position",
icon: image
});
marker.setMap(map);
}
$(function () {
initialize();
});
</script>
<div id="map_canvas" style="width: 800px; height: 400px;margin-top:15px;">
【问题讨论】:
-
这对我来说是正确的。你的
map_canvascss 是什么?此外,它是否会在 FF 中生成任何内容(部分地图或灰色地图空间?) -
我的 map_canvas 是一个简单的 divhmm.. 通常问题是没有指定高度和宽度。如果删除标记会发生什么?它在 FF 中有效吗?即使我删除了标记,也是同样的问题。 div 在这里,但地图不在如果您有萤火虫,请尝试在该控制台中调用
initialize,然后查看它是否加载。不久前我有一个非常相似的问题。我正在制作带有多个标记的地图,但它出错了。为我解决的问题是在创建地图后立即设置所有边界和所有标记,但我认为这不是你的问题。
标签: jquery jquery-ui firefox google-maps