我正在尝试在另一个 jsp 页面 div 中加载一个包含 google map 的 jsp 页面,但它没有在该 div 上显示地图。其他两个 jsp 页面已处理,未处理的 div 很好。
// JSP hello.jsp
<script>
$(function() {
$( "#tabs" ).tabs();
$("#map_canvas").load("map.jsp");
$("#tabs-1").load("Processed.jsp");
$("#tabs-2").load("UnProcessed.jsp");
});
</script>
<div id="tabs">
<ul>
<li> <a href="#map_canvas">GMaps</a></li>
<li> <a href="#tabs-1">Processed </a></li>
<li> <a href="#tabs-2">UnProcessed </a></li>
</ul>
<div id ="map_canvas"></div>
<div id="tabs-1"></div>
<div id="tabs-2"></div>
</div></body></html>
// map.jsp
<head>
<title>Simple Map</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<style>
#map-canvas {
margin: 0;
padding: 0;
width: 600px;
height: 300px;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<script>
var map;
function initialize() {
var mapOptions = {
zoom: 8,
center: new google.maps.LatLng(-34.397, 150.644),
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById('map-canvas'),
mapOptions);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<body>
<div id="map-canvas"></div>
</body>
</html>
// I had already spent too much time on this but still not getting result , map is not loading on page , please help me to load map.jsp on`map_canvas` div in hello.jsp . Thanks A tonn...