javascript - HTML file won't find JS and CSS files -
my page should show single google map.
if throw code in jsfiddle, works fine.
all of files in same directory. tested in chrome , firefox, both don't show map. think there must way calling access javascript , css.
html
<html> <head> <link rel="stylesheet" type="text/css" href="bob.css"> <script src="https://maps.googleapis.com/maps/api/js?sensor=false"></script> </head> <body> <h1>my heading</h1> <div id="map"></div> <p>my paragraph.</p> <script type="text/javascript" src="bob.js"></script> </body> </html>
bob.js
var mapoptions = { center: new google.maps.latlng(37.7831,-122.4039), zoom: 12, maptypeid: google.maps.maptypeid.roadmap }; new google.maps.map(document.getelementbyid('map'), mapoptions);
bob.css
html, body { height: 100%; margin: 0; } #map { height: 100%; margin: 0; }
console output
perhaps server (mis)configured in way relative paths don't work. if files in root directory, absolute path won't hurt.
try:
<link rel="stylesheet" type="text/css" href="/bob.css"> <script type="text/javascript" src="/bob.js"></script>
Comments
Post a Comment