请我需要帮助...当我单击每个标记时,我想为每个标记显示一个信息窗口。请原谅我的英语不好。谢谢。
markers=new Array();
for(i=0;i<res['infos'].length;i++){
var a=new Object();
a.lat=res.infos[i]['lat'];
a.lng=res.infos[i]['lng'];
var Titre="Véhicule: "+res.infos[i]['NomVehicule']+" Position du: "+res.infos[i]['Date']+" à "+res.infos[i]['Heure'];
var NomIcone="IconeVehicule/"+res.infos[i]['Icone'];
var point=new google.maps.LatLng(a.lat,a.lng);
var marker = new google.maps.Marker({position: point,map: map, title: Titre, icon: NomIcone});
markers.push(marker);
google.maps.event.addListener(marker, 'mouseover', (function(marker, i) {
return function() {
infowindow.setContent(res.infos[i]['NomVehicule']);
infowindow.open(map, marker);
}
})(marker, i));
}
</script>