无论出于何种原因,我都无法在此文件中加载此api。 (是的,我知道我可能在其他方面使用了糟糕的方法,但显然我还不是专业人士)
<html>
<head>
<title>Main Street Ink - Homepage</title>
<link rel="stylesheet" type="text/css" href="styles.css">
<script src="https://maps.googleapis.com/maps/api/js"></script>
<script>
function initialize() {
var mapCanvas = document.getElementById('map_canvas');
var mapOptions = {
center: new google.maps.LatLng(44.5403, -78.5463),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(mapCanvas, mapOptions)
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
</head>
<div id = "mainBody">
<div id = "banner"><img src = "http://placehold.it/700x250" alt = "Placeholder" /></div>
<span id = "header">Main Street Ink</span>
<span id = "subHead">Located at 529 N. Main Street, Findlay, OH</span>
<div id="map_canvas"></div>
</div>
答案 0 :(得分:0)
你应该发布你的CSS:
#map_canvas {
width: 500;
height: 400;
}
问题是拼写错误,错过了&#34; px&#34;,应该是
#map_canvas {
width: 500px;
height: 400px;
}