that is inside another div, and I put ...">

Google map not showing

I need to implement a php page on my page. I have a container <div id="map"></div>that is inside another div, and I put this code inside the tag <head>, but it does not appear at all. Can anybody help me?

<script type="text/javascript" src="javascript/jquery-1.4.3.js"></script>
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
(function() {
    window.onload = function() {
        var mapDiv = document.getElementById('map');
        var latlng = new google.maps.LatLng(37.09, -95.71);
        var options = {
            center: latlng,
            zoom: 4,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
        var map = new google.maps.Map(mapDiv, options);
    }
})();​
</script>
+3
source share
5 answers

Did you specify the size for your div? eg:

<div id="map" style="width: 300px; height: 300px;"></div>

If this does not work, you may need to post a snippet of your HTML and CSS.

+11
source

- , , , jquery. jQuery (document).ready(function ($) {  $ (() {     // .  }); });

+4

, , , , , - , . , , . :

  • #map , .
  • javascript $(document).ready(), , .
  • , , , , , .

, .

+1

HTML doctype. Google , .

. this

0

- google javascript jquery , / https://localhost/test/ https://example.com.

URL-, https

0

Source: https://habr.com/ru/post/1770120/


All Articles