0

几个月来,我一直在使用 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>

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

4

0 回答 0