0
我在NetBeans(Servlet/JSP/mobile jQuery)中构建一个项目,我必须在Google Map上显示车辆的最后位置。现在,我在显示另一个JSP页面的按钮单击上显示地图。Google Map在我的网页上显示div但不显示
地图部门发生了什么,但没有显示地图,如果我将该页面单独作为运行文件右键单击,则会显示Google地图。另外,如果移除jQuery for mobile并在不使用移动jQuery的情况下运行该项目,它将正常运行。
任何人都可以解释为什么它发生?
JSP页面在这里我要显示我的地图是:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyDY0kkJiTPVd2U7aTOAwhc9ySH6oHxOIYM&sensor=false"></script>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
</head>
<body>
<script>
$("div:jqmData(role='page'):last").bind('pageinit', function() {
if(navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function(position){
initialize(position.coords.latitude,position.coords.longitude);
});
}
}); `
function initializemap()
{
var mapProp123 = {
center: new google.maps.LatLng(51.508742, -0.120850),
zoom: 5,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map123 = new google.maps.Map(document.getElementById("googleMap123")
, mapProp123);
}
</script>
<div data-role="main" class="ui-content">
<p>I Am Now A Mobile Developer!!</p>
<input type="button" value="get map" onclick="initializemap();">
<div id="googleMap123" style="height: 300px;"></div>
</div>
</body>
</html>
这并不包含在代码... $(“分区:jqmData如果(navigator.geolocation)navigator.geolocation.getCurrentPosition(function(position){ initialize(position.coords.latitude)('page'):last“)。 ,position.coords.longitude); }); } }); ' – user3547883