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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
<html>
<head>
<script src="http://maps.google.com/maps?file=api&v=2&key=mykey"
type="text/javascript"></script>
<?php
$scriptgmap = '<script type="text/javascript">
//<![CDATA[
var NomSociete = "my societe";
var Adresse = "my adresse";
var CodePostal = "zip code";
var Ville = "country";
function load() {
if (GBrowserIsCompatible()) {
// Initialisation de l\'objet GClientGeocoder
geocoder = new GClientGeocoder();
// Initialisation de l\'adresse
adresse = "14, rue Royale Bruxelles Belgium";
// Appel de la fonction d\'affichage de l\'adresse
showAddress(adresse);
function showAddress(address)
{
if (geocoder)
{
geocoder.getLatLng(address, function(point)
{
if (!point) {alert(address + " not found");} // Adresse non connue par Google Maps
else
{
// Fonction permettant la cr�ation du marker //
function createMarker(point) {
var marker = new GMarker(point);
GEvent.addListener(marker, \'click\', function() {
// formulaire_itineraire
var formulaire_itineraire =\'<div style="width:350px; height:160px; border: 1px solid #ccc; text-align:center; background:#efffef; font: 12px \\\'trebuchet ms\\\',verdana, helvetica, sans-serif;">\' +
\'<br /><b>entrer_adresse</b>\' +
\'<form action="http://maps.google.com/maps" method="get" target="_blank" style="margin:0;padding:0">\' +
\'<input type="text" name="saddr" id="saddr" value="" style="width:300px; height:20px; border:1px solid grey;" /><br />\' +
\'<b>adresse_arriver</b><br />\'+NomSociete+\'<br />\'+Adresse+\'<br />\'+CodePostal+\' \'+Ville+\'<br />\' +
\'<input value="calculer_gmail" type="submit">\' +
\'<input type="hidden" name="daddr" value="\'+LatitudeDestination+\',\'+LongitudeDestination+\'"/>\'+
\'</form>\' +
\'</div>\';
marker.openInfoWindowHtml(formulaire_itineraire);
});
return marker;
}
var MaCarte = new GMap2(document.getElementById(\'EmplacementDeMacarte\'));
MaCarte.addControl(new GSmallMapControl());
MaCarte.addControl(new GMapTypeControl());
MaCarte.addOverlay(createMarker(point));
}else{
alert(\'googlemap_pas_compatible\');
}
}
}
}
}
//]]>
</script>';
echo $scriptgmap;
?>
</head>
<body onload="load()" onunload="GUnload()">
<div id="gmap"><div id="EmplacementDeMacarte" style="width: 600px; height: 420px"></div></div>
</body>
</html> |
Partager