Showing posts with label java script. Show all posts
Showing posts with label java script. Show all posts

Wednesday, January 12, 2011

Google Maps - JavaScript API V3 (Saying Hello World with Google Maps)

This simple Google Map shows my place- hyderabad using the JavaScript API V3
save this as a html page and enjoy...

<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
  html { height: 100% }
  body { height: 100%; margin: 0px; padding: 0px }
  #map_canvas { height: 100% }
</style>
<script type="text/javascript"
    src="http://maps.google.com/maps/api/js?sensor=true">
</script>
<script type="text/javascript">
  function initialize() {
    var latlng = new google.maps.LatLng(17.375278, 78.474444);
    var myOptions = {
      zoom: 8,
      center: latlng,
      mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var map = new google.maps.Map(document.getElementById("map_canvas"),
        myOptions);
  }


</script>
</head>
<body onload="initialize()">
  <div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>

Is this code Running ? - Read more about the various components in detail.

subversion video