Je suis un débutant et en utilisant openInfoWindowHtml pour afficher le texte ballon. mon application a une option pour montrer l'emplacement unique et l'emplacement multiple.problème avec openInfoWindowHtml pour plusieurs points en utilisant des événements
Le texte de mon ballon à emplacement unique fonctionne correctement à l'aide de openInfoWindowHtml();
Mais quand je vais dans plusieurs, il montre toujours le dernier texte de points et l'événement de clic pour tous les points n'arrive jamais.
extrait de code:
var markers =[];
for(var i=0;i<(geoList.length)-1;i++)
{
var geo = (geoList[i]).split(',');
map.setCenter(new GLatLng(geo[3], geo[4]), 2);
var ip_point = new GLatLng(geo[3], geo[4]);
//creating a marker
marker = new GMarker(ip_point);
map.addOverlay(marker);
markers[i] = marker;
// The ballon text which shows the details of the ip address
var ip = "<div style=\"font-family:Verdana;font-size:10px;text-align:left\">";
//var dbName = base64_decode(geo[5]); // added on 14Dec2009
//If IP is not found it goes to else loop
if(geo.length== 9){
ip += "<span class=\"FSColorBold\">"+geo[5]+"</span><br /> ";
ip += "<?php __('IP:'); ?>"+geo[6]+"<br />";
ip += "<?php __('ID:'); ?>"+geo[7]+"<br />";
ip += "<?php __('Last Accessed: '); ?>"+geo[8]+"<br />";
ip += geo[2]+","+geo[1]+"<br />";
}
}
// shows IP details info by default
map.openInfoWindow(map.getCenter(),ip);
// Reloads the IP details info on clicking the marker
GEvent.addListener(marker, "click", function(){
marker.openInfoWindowHtml(ip+'');});
Les points sont dans une boucle et les écouteurs d'événement sont en dehors de la boucle. Est-ce que quelqu'un peut me dire exactement ce qui s'est mal passé?