Google Maps on your website

Do you know how to put a google map on your website ? If no take a minute to lean.

First off all get your api from http://code.google.com/apis/maps/signup.html

Now put the code on your website and replace with your address

<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=YOUR_API_KEY_HERE"
      type="text/javascript"></script>

<script type="text/javascript">
//<![CDATA[
function loadmap() {
if (GBrowserIsCompatible()) {
var map = new GMap2(document.getElementById("map"));
var geocoder = new GClientGeocoder();
map.setCenter(new GLatLng(coordonates, coordonates), 13);
map.addControl(new GSmallMapControl());
var address = "your adress";
geocoder.getLatLng(
address,
function(point) {
if (!point) {
alert(address + " not found");
} else {
map.setCenter(point, 13);
var marker = new GMarker(point);
map.addOverlay(marker);
marker.openInfoWindowHtml(
"<strong>Location</strong>"+
" <br>Type your location");
}
}
);
}
}
// this part uses jquery:
$(window).load(function(){loadmap()});
// if you dont have jquery, do something like:
window.onload = loadmap;
//]]>
</script>

<div id="map" style="width: 300px; height: 400px">
</div>
This entry was posted in Uncategorized and tagged , , , . Bookmark the permalink.




2 Responses to Google Maps on your website

  1. Pingback: google maps jquery | GOOGLE

  2. A very nice niche blog, and a good design there sparks Simplicity yet complex algorithm of the internet. Thank You