2014-09-25 48 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; 
}