我的Google Maps API地图无效 - 显示白色

时间:2013-10-11 09:18:36

标签: google-maps-api-3

我已经使用Maps API生成了一些谷歌地图已经好几个月了,一切都很好。突然他们停止了工作,我不明白为什么。

这是一张以前运作良好的简单地图:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Google Maps Demo</title>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

var map = null;
function initialize() {

var myOptions = {
zoom: 12,
scaleControl: true,center: new google.maps.LatLng(-33.7317470,151.0791569),
mapTypeId: google.maps.MapTypeId.ROADMAP
 }
 map = new google.maps.Map(document.getElementById("map_canvas"),
 myOptions);
google.maps.event.addListener(map, 'click', function() {
infowindow.close();
});

var point = new google.maps.LatLng(-33.0113130,151.5838010);
var icon = 'https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png';
var marker = createMarker(point,'<p style="font-size:14px">John Smith<br>123 Smith St, Sydney<br>Distance away: 92.7 km<br> Phone H: <a href="sip:02 1234 5678">02 1234 5678</a><br> Phone M: <a href="sip:0412 345 678">0412 345 678</a><br>Acme Inc</p>', icon)

}
var infowindow = new google.maps.InfoWindow(
{ 
size: new google.maps.Size(100,20)
});
function createMarker(latlng, html, icon) {
var contentString = html;
var marker = new google.maps.Marker({
position: latlng,
icon: icon,
map: map,
zIndex: Math.round(latlng.lat()*-100000)<<5
});
google.maps.event.addListener(marker, 'click', function() {
 infowindow.setContent(contentString);
infowindow.open(map,marker);
});
}
</script>
</head>
<body style="margin:0px; padding:0px;" onload="initialize()">
<div id="map_canvas"></div>
</body>
</html>

现在由于某种原因,我无法看到地图 - 我得到一个空白的白色网页浏览器页面。任何人都可以发现错误或最近更改了地图API - 我没有必要生成几周的地图,这是我最后一次尝试并且工作正常。

0 个答案:

没有答案