Google Maps API 教程(https://developers.google.com/maps/tutorials/fundamentals/adding-a-google-map)给了我一个空白屏幕。我已经为此工作了 3 个小时,但无法弄清楚。
我什至完全复制/粘贴了代码,它被保存为 .html 文件。
<!DOCTYPE html>
<html>
<head>
<style>
#map_canvas{
height: 500px;
width: 400px;
}
</style>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script>
function initialize() {
var map_canvas = document.getElementById('map_canvas');
var map_options = {
center: new google.maps.LatLng(44.5403, -78.5463),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(map_canvas, map_options)
}
google.maps.event.addDomListener(window, ‘load’, initialize);
</script>
</head>
<body>
<div id="map_canvas"></div>
</body>
</html>