在谷歌浏览器中,一切正常。但是在火狐浏览器中加载时,Google地图的右侧将为空白。所有代码功能似乎都正常工作(Spring MVC和Jquery)。您也可以在sameplaces.heroku.com上查看应用程序。谢谢。
<html>
<head>
<link rel="stylesheet" href="resources/development-bundle/themes/base/jquery.ui.all.css">
<script type="text/javascript" src="resources/js/jquery-1.9.1.js"></script>
<script src="resources/development-bundle/ui/jquery.ui.core.js"></script>
<script src="resources/development-bundle/ui/jquery.ui.widget.js"></script>
<script src="resources/development-bundle/ui/jquery.ui.button.js"></script>
<link rel="stylesheet" type="text/css" href="resources/css/layout.css"/>
<script type="text/javascript"
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyA8_h_OaZwi_KRiDev5M8PUxhKRuKbOj1Q&sensor=true">
</script>
<script type="text/javascript">
$(function(){
$("input[type=submit],input[type=button],a,button")
.button()
.click(function(event){
event.preventDefault();
});
});
var initialLocation;
var siberia = new google.maps.LatLng(60, 105);
var newyork = new google.maps.LatLng(40.69847032728747, -73.9514422416687);
var browserSupportFlag = new Boolean();
function initialize() {
var mapOptions = {
zoom: 13,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map-canvas"),
mapOptions);
if(navigator.geolocation) {
browserSupportFlag = true;
navigator.geolocation.getCurrentPosition(function(position) {
initialLocation = new google.maps.LatLng(position.coords.latitude,position.coords.longitude);
map.setCenter(initialLocation);
}, function() {
handleNoGeolocation(browserSupportFlag);
});
}
// Browser doesn't support Geolocation
else {
browserSupportFlag = false;
handleNoGeolocation(browserSupportFlag);
}
function handleNoGeolocation(errorFlag) {
if (errorFlag == true) {
alert("Geolocation service failed.");
$(".address_search_div").show();
initialLocation = newyork;
} else {
alert("Your browser doesn't support geolocation. We've placed you in Siberia.");
initialLocation = siberia;
}
map.setCenter(initialLocation);
}
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<table width="100%" height="100%">
<tr>
<td width="35%" height="100%"><t:insertAttribute name="menu"/></td>
<td width="65%" height="100%"><t:insertAttribute name="map"/></td>
</tr>
</table>
</body>
</html>
map-canvas
在哪里? - putvandelink
标签。最后一个标签使用了/>
正确地关闭了,而第一个标签没有。 - Anto Jurković.address_search_div
类的元素在哪里? - Anto Jurković