我正在尝试在我的网站中使用谷歌地图v2但是地图不会出现在Firefox中,即它出现在Chrome中。我找不到问题,有谁知道代码中的问题是什么?可以在http://www.ideiah.com/contato
查看地图代码:
<script src="http://maps.google.com/maps?file=api&v=2&key=AIzaSyAPPKVsGOmTcBlOo_FkNi4QBn19RKBPMeI" type="text/javascript"></script>
<script type="text/javascript">
//<![CDATA[
function MyIndexOf(arr, element)
{
for(i = 0; i < arr.length; i++)
{
if( arr[i] == element)
return i;
}
return -1;
}
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
//mapGDynamicMap2
function GetMapIndex(map)
{
var currentMapType = map.getCurrentMapType();
return MyIndexOf(map.getMapTypes(),currentMapType);
}
function SetMapIndex(map,mapTypeIndex)
{
map.setMapType(map.getMapTypes()[mapTypeIndex]);
}
function LoadMapmapGDynamicMap2(){
var mapGDynamicMap2 = new GMap2(document.getElementById("GDynamicMap2"));
mapGDynamicMap2.setCenter(new GLatLng(-29.789195,-55.768093), 17);
mapGDynamicMap2.setMapType(mapGDynamicMap2.getMapTypes()[2]);
SetMapIndex(mapGDynamicMap2,0);
mapGDynamicMap2.addControl(new GMenuMapTypeControl());
mapGDynamicMap2.addControl(new GSmallMapControl());
mapGDynamicMap2.addControl(new GOverviewMapControl());
var pointGDynamicMarker7141266 = new GLatLng(-29.789241,-55.768329);
var GDynamicMarker7141266 = new GMarker(pointGDynamicMarker7141266, {icon:G_DEFAULT_ICON, draggable: false});
GDynamicMarker7141266.bindInfoWindowHtml('Ideiah Soluções em Software');
mapGDynamicMap2.addOverlay(GDynamicMarker7141266);
GEvent.addListener(mapGDynamicMap2, "zoomend", function(){document.getElementById("mapGDynamicMap2ZoomLevel").value=mapGDynamicMap2.getZoom();;
});
GEvent.addListener(mapGDynamicMap2, "moveend", function(){document.getElementById("mapGDynamicMap2Center").value=mapGDynamicMap2.getCenter().toUrlValue();;
});
GEvent.addListener(mapGDynamicMap2, "maptypechanged", function(){document.getElementById("mapGDynamicMap2MapType").value=GetMapIndex(mapGDynamicMap2);;
});
}
//]]>
</script>
<div>
<span id="mapGDynamicMap2ZoomLevel" value="17"></span>
<span id="mapGDynamicMap2Center" value="-29.789195,-55.768093" ></span>
<span id="mapGDynamicMap2MapType" value="0" ></span>
</div>
<div class="GMPdiv img-polaroid" style="width:90% !important; margin: 0 auto;">
<div id="GDynamicMap2" class="GMPmap" style="width:100%;height:200px;"></div>
</div>
<script type="text/javascript">
//<![CDATA[
LoadMapmapGDynamicMap2();//]]>
</script>
答案 0 :(得分:3)
答案 1 :(得分:0)
在Google Maps API v2中加载地图的一般规则是:
</body>
标记之前(此方法对无效HTML非常敏感,these errors似乎没有太大问题,但在您修复之前,不能说确定问题是什么)您正在尝试内联初始化地图(以上都不是。)