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
|
<script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.1&sensor=false"></script>
<script type="text/javascript">
var g = google.maps; // Permet d'écrire plus vite les déclarations d'objets GM
var map;
var imagePointer = '<?php echo $imageName; ?>';
var mapAgence = function (Lat, Lng, id_agence) {
var point = new g.LatLng(Lat, Lng);
// Création de ma carte
var optionsMap = {
center: point,
zoom: 15,
mapTypeId: g.MapTypeId.ROADMAP
};
map = new g.Map(document.getElementById("map_canvas_"+id_agence), optionsMap);
// Attachemement d'un marker
var icon = new g.MarkerImage(
'/images/gestAg/'+imagePointer,
new g.Size(278, 80),
new g.Point(0, 0),
new g.Point(103, 79)
);
var optionsMarker = { // Les options du Marker afin de le définir
icon: icon,
map: map,
position: point
};
var marker = new g.Marker(optionsMarker);
g.event.addListener(marker, 'click', function() {
alert ("map_canvas_"+id_agence);
});
};//end:: funtion mapAgence
</script>
// ...
// Du code en html
// ...
<div id="map_canvas_<?php echo $rowAg['id_agence']; ?>" style="width:390px; height:290px; "></div>
// ...
// Du code en html
// ...
<script type="text/javascript">
mapAgence (<?php echo $rowAg['compAg_gmap_lat']; ?>, <?php echo $rowAg['compAg_gmap_long']; ?>, <?php echo $rowAg['id_agence']; ?> );
</script> |
Partager