我正在尝试使用此 javascript 将一个 html 页面加载到另一个 html 页面中
$('.myajax').click(function() {
var myhref=$(this).attr('href');
$('#contentdiv').hide().load(myhref).fadeIn('slow');
return false;
});
每当我尝试将 Google 地图加载到名为contentdiv
. 每当我尝试这样做时,浏览器上都不会出现任何内容;它完全空白。包含谷歌地图的页面如下:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps Geocoding Demo</title>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
</head>
<body>
<div id="map" style="width: 400px; height: 300px;"></div>
<script type="text/javascript">
var address = 'London,UK';
var map = new google.maps.Map(document.getElementById('map'), {
mapTypeId: google.maps.MapTypeId.ROADMAP,
zoom: 6
});
var geocoder = new google.maps.Geocoder();
geocoder.geocode({
'address': address
},
function(results, status) {
if(status == google.maps.GeocoderStatus.OK) {
new google.maps.Marker({
position: results[0].geometry.location,
map: map
});
map.setCenter(results[0].geometry.location);
}
else {
// Google couldn't geocode this request. Handle appropriately.
}
});
</script>
</body>
</html>
有人可以指出错误吗?