1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
<div id="map" style="width: 570px; height: 440px; border: 1px solid black; margin-right: auto; margin-left: auto;"></div>
<script type="text/javascript">
//<![CDATA[
<!--
if (GBrowserIsCompatible())
{
// A function to create the marker and set up the event window
// Dont try to unroll this function. It has to be here for the function closure
// Each instance of the function preserves the contends of a different instance
// of the "marker" and "html" variables which will be needed later when the event triggers.
function createMarker(point,html)
{
var marker = new GMarker(point);
GEvent.addListener(marker, "click", function()
{
marker.openInfoWindowHtml(html);
});
return marker;
}
// Display the map, with some controls and set the initial location
var map = new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(43.501437,6.644325),11);
// Set up three markers with info windows
var point = new GLatLng(43.501437,6.644325);
var marker = createMarker(point,'Starcompsud')
map.addOverlay(marker);
}
// display a warning if the browser was not compatible
else
{
alert("Désolé, l'API Google Maps n'est pas compatible avec votre navigateur.");
}
//-->
//]]>
</script> |
Partager