Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Google Maps API problem: Map not displaying

    This is the code I'm using. Please help me on this. Map is not appearing.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<title>Real Time GPRS based GPS Tracker</title>
    		<script src="http://maps.google.com/maps?file=api&v=1" type="text/javascript"></script>
    		<!-- Make the document body take up the full screen -->
    		<style type="text/css">
    			v\:* {behavior:url(#default#VML);}
    			html, body {width: 100%; height: 100%}
    			body {margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0px}
    		</style>
    
    		<script type="text/javascript">
    			function load()
    			{
    				var map = new GMap(document.getElementById("map"));
    				var point = new GPoint(0,0);
    
    				map.addControl(new GLargeMapControl());
    				map.addControl(new GMapTypeControl());
    				map.centerAndZoom(point, 1);
    			}
    		</script>
    	</head>
    	<body onload="load()">
    		<div id="map" style="width: 100%; height:100%;"></div>
    	</body>
    </html>
    Last edited by sage45; 06-26-2014 at 05:33 PM. Reason: Please use code tags

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts

    API version 1?!?

    Interesting move, considering that API version 2 has been deprecated. Here's more or less what it would look like using v3
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    	<head>
    		<title>Real Time GPRS based GPS Tracker</title>
    <script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.8&sensor=false"></script>
    		<!-- Make the document body take up the full screen -->
    		<style type="text/css">
    			v\:* {behavior:url(#default#VML);}
    			html, body {width: 100%; height: 100%}
    			body {margin-top: 0px; margin-right: 0px; margin-left: 0px; margin-bottom: 0px}
    		</style>
    
    		<script type="text/javascript">
    			function load()
    			{
    				
    				var myOptions = {
          zoom: 1,
          center: new google.maps.LatLng(0,0),
          mapTypeId: google.maps.MapTypeId.ROADMAP
    	  }
    				
    			var map = map = new google.maps.Map(document.getElementById("map"), myOptions);
    			}
    		</script>
    	</head>
    	<body onload="load()">
    		<div id="map" style="width: 100%; height:100%;"></div>
    	</body>
    </html>


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •