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 72
|
<script type="text/javascript" src="http://www.google.com/jsapi?key=">
</script>
<script type="text/javascript">
google.load("maps", "2" );
function initialize()
{
var map = new google.maps.Map2(document.getElementById("map" ));
map.setCenter(new google.maps.LatLng(46.850095, 2.509003), 5);
}
google.setOnLoadCallback(initialize);
</script>
<script type="text/javascript">
//<![CDATA[
function load() {
if (GBrowserIsCompatible()) {
function createMarker(point, number) {
var marker = new GMarker(point,icon);
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowTabsHtml(infoTabs);
});
return marker;
}
var infoTabs = [
new GInfoWindowTab("Description", "maison de 200m² en bord de plage"),
new GInfoWindowTab("Photo", " ")
];
//création d'une carte nommé "map"
var map = new GMap2(document.getElementById("map"));
GEvent.addListener(map, "moveend", function() {
var center = map.getCenter();
});
map.addControl(new GSmallMapControl());
map.enableScrollWheelZoom();
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(46.850095, 2.509003), 5);
var icon = new GIcon();
icon.image = "./marker.png";
icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
icon.iconSize = new GSize(20, 19);
icon.shadowSize = new GSize(22, 20);
icon.iconAnchor = new GPoint(6, 20);
icon.infoWindowAnchor = new GPoint(10, 34);
<?php while ($donnees = mysql_fetch_array($reponse))
{
?>
var point = new GLatLng('<?php echo $donnees['latitude'];?>','<?php echo $donnees['longitude'];?>');
var infoTabs = [new GInfoWindowTab("", "")];
var marker = new createMarker(point,icon,infoTabs);
map.addOverlay(marker);
<?php
}
?>
}
}
</script> |
Partager