Salut,
je dois faire une boucle en javascript pour faire apparaitre plusieurs marqueurs sur une map google, mais je ne suis pas capable. Si vous pouvez m'aider cela serait très apprécié !

Merci !

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
 
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> 
<script type="text/javascript"> 
 
var iterator = 0;
 
function initialize() {
	var myHome = new google.maps.LatLng(<%=Latitude%>, <%=longitude%>);
	var myOptions = {
    zoom: 8,
    center: myHome,
    mapTypeId: google.maps.MapTypeId.ROADMAP
  }
  var map = new google.maps.Map(document.getElementById("map_canvas"),
                                myOptions);
 
 
  // Marker sizes are expressed as a Size of X,Y
  // where the origin of the image (0,0) is located
  // in the top left of the image.
 
  // Origins, anchor positions and coordinates of the marker
  // increase in the X direction to the right and in
  // the Y direction down.  
  var iconHome = new google.maps.MarkerImage('/images/google/marqueur.png',
      new google.maps.Size(44, 44),
      new google.maps.Point(44,0),
      new google.maps.Point(22, 22));
 
 
  var marker = new google.maps.Marker({
      position: myHome, 
	  icon: iconHome,
      map: map, 
      title:"Vous etes ici !"
  }); 
 
 
  function drop() {
    for (var i = 0; i < listeMarqueur.length; i++) {
      setTimeout(function() {
 
 
  setMarkers(map, listeMarqueur);
	infowindow = new google.maps.InfoWindow({
		content: "...",
		maxWidth: 110
	});
 
      }, i * 250);
    }
  }
 drop();
 
}
 
/**
 * Data for the markers consisting of a name, a LatLng ,a zIndex, html desc and a maker type for
 * the order in which these markers should display on top of each
 * other.
 */
for (i=1; i<=<%=countent%>; i++) {
 
	var listeMarqueur = [
	  ['<%=rs_marchand("nom")%>', <%=LatitudeEntreprises%>, <%=longitudeEntreprises%>, <%=countent%>, '<div id="gmInfoWindow"><p><b><%=rs_marchand("nom")%></b><br\/><i>Détaillant Laurentide</i><\/p><p><%=rs_marchand("ncivic")%>, <%=rs_marchand("rue")%><br><%=rs_marchand("ville")%><br\/><%=rs_marchand("province")%><br><%=rs_marchand("codepostal")%><br>Tél: <%=rs_marchand("tel")%></p><\/div>'],
	];
 
}
 
function setMarkers(map, locations) {
 
  var iconRed = new google.maps.MarkerImage('/images/google/marqueur.png',
      new google.maps.Size(44, 55),
      new google.maps.Point(88,0),
      new google.maps.Point(22, 44));
  var iconWhite = new google.maps.MarkerImage('/images/google/marqueur.png',
      new google.maps.Size(44, 55),
      new google.maps.Point(132,0),
      new google.maps.Point(22, 44));
  var iconRecup = new google.maps.MarkerImage('/images/google/marqueur.png',
      new google.maps.Size(44, 55),
      new google.maps.Point(176,0),
      new google.maps.Point(22, 44));
  var ombre = new google.maps.MarkerImage('/images/google/marqueur.png',
      new google.maps.Size(44, 55),
      new google.maps.Point(0,0),
      new google.maps.Point(12, 44));
 
 
//for (var i = 0; i < locations.length; i++) {
 
		var detaillant = locations[iterator];
		var myLatLng = new google.maps.LatLng(detaillant[1], detaillant[2]);
		var marker = new google.maps.Marker({
			position: myLatLng,
			map: map,
			icon: iconWhite,
			shadow: ombre,
			title: detaillant[0],
			zIndex: detaillant[3],
			html : detaillant[4],
			draggable: false,
			animation: google.maps.Animation.DROP
		});
		google.maps.event.addListener(marker, "click", function () {
			infowindow.setContent(this.html);
			infowindow.setOptions({maxWidth:120})
			infowindow.open(map, this);
		});
		iterator++;
 
  //}
 
}
</script> 
 
}
Cette partie du code ne fonctionne pas (cest la boucle que jai tenté de créer)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
for (i=1; i<=<%=countent%>; i++) {
 
	var listeMarqueur = [
	  ['<%=rs_marchand("nom")%>', <%=LatitudeEntreprises%>, <%=longitudeEntreprises%>, <%=countent%>, '<div id="gmInfoWindow"><p><b><%=rs_marchand("nom")%></b><br\/><i>Détaillant Laurentide</i><\/p><p><%=rs_marchand("ncivic")%>, <%=rs_marchand("rue")%><br><%=rs_marchand("ville")%><br\/><%=rs_marchand("province")%><br><%=rs_marchand("codepostal")%><br>Tél: <%=rs_marchand("tel")%></p><\/div>'],
	];
 
}