kushaldsouza
kushaldsouza

Reputation: 708

Initializing Javascript Google Maps issue

I am having an issue initializing a map in the page. The code within my body tags is shown below:

<body>
      <div class="outer">
            <div class="header">
            </div>
            <div class="main">
                  <div id="map_canvas">
                  </div>
            </div>
            <div class="footer">
            </div>
              </div>
</body>

When I initialise the function on the main class, the map displays properly.

var map = new google.maps.Map(document.getElementById("main"), myOptions);

However when the map is initialised as shown below, it does not display at all on the page.

var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

I am not sure what is causing this or how to fix it. Any help is greatly appreciated.

Upvotes: 0

Views: 469

Answers (1)

box86rowh
box86rowh

Reputation: 3415

Your map_canvas div needs to have its id set to "map_canvas" also be sure that the css for map_canvas div is set to have a width and height.

Upvotes: 1

Related Questions