dazzle
dazzle

Reputation: 115

Google maps not showing up

I have a written a simple code which would display the location on the google map. But for some reasons its not showing up. Any idea whats happening?

<html>
<head>
<title>Google Maps </title>
<script type="text/javascript" 
src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
(function() {
   window.onload = function(){
   var latlng = new google.maps.LatLng(57.8, 14.0);
   var options = {
      zoom: 6,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
        }; 
  var map = new google.maps.Map(document.getElementById('map'), options);
        }
    })();
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>

Upvotes: 10

Views: 11417

Answers (1)

Jorge Zapata
Jorge Zapata

Reputation: 2336

You need to set dimensions for your map container, try this:

<style type="text/css">
     #map {
        width: 500px;
        height: 500px;
      }
    </style>

Upvotes: 33

Related Questions