website metrics

Include Maps Google API in Your Site

Introduction Google maps is one of the first applications implemented with

AJAX , today I will show you how to put the site map in your site (specifying the location).

Google Maps APIs will help you to include the map in your site in some few steps, just follow the steps and you will include it in you site.

Steps 1-     visit the Google Maps API  site http://maps.google.com/apis/maps

2-     sign up your site to take a new PIN for your site

3-     copy and past the following code in your page

<!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>

     <meta http-equiv=”content-type” content=”text/html; charset=UTF-8″/>

<title>Google Maps JavaScript API Example: simple</title>
     <script src=”http://maps.google.com/maps?file=api&v=1&key=API_PIN                     type=”text/javascript”>
     </script>
     <script type=”text/javascript”>
     //<![CDATA[
     function onLoad() {
       // The basics.
       //
       / Creates a map and centers it on 

       if (GBrowserIsCompatible()) {

             var map = new GMap(document.getElementById(”map”)); 
             map.centerAndZoom(new GPoint(-122.1419, 37.4419), 4); 
       }

     }

     //]]>

     </script>

  </head>

  <body onload=”onLoad()”>

     <div id=”map” style=”width: 500px; height: 300px”></div>
  </body>

</html>

4-     The red bold line in code will be replaced by the Geographical code (Latitude, Longitude)

5-     Replace the API_PIN with your site API pin

6-     use http://www.infosports.com/m/map.htm to get the (Latitude, Longitude) of your country

7-     publish the site J

 

 

Related Posts...

No Comments! Be The First!

Leave a Reply

You must be logged in to post a comment.