2014-09-25 49 views
0

无论出于何种原因,我无法设法让这个API加载到这个文件中。 (是的,我知道我可能使用其他的东西可怕的方法,但很明显,我没有亲还)谷歌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

什么是styles.css? – geocodezip 2014-09-25 04:11:49

+1

Just #map_canvas { \t width:500; \t身高:400; } – Obesio 2014-09-25 04:15:05

+0

这是不正确的应该是'#map_canvas {width:500px;高度:400px;}'。这是一个错字吗? – geocodezip 2014-09-25 04:19:54

回答

0

你应该已经张贴你的CSS :

#map_canvas { 
    width: 500; 
    height: 400; 
} 

问题是一个错字,缺少“px”,应该是

#map_canvas { 
    width: 500px; 
    height: 400px; 
}