HI
try this, the popupHandler closure is outside the loop for clarity but when
you are accustomed to the syntax you can declare it anonymously inline.
Regards
var popupHandler = function(marker){
return function(e){
popup = new OpenLayers.Popup.FramedCloud("chicken",
marker.lonlat, new
OpenLayers.Size(200, 200),
marker.lonlat, null, true);
map.addPopup(popup);
}
}
for ( var i = 0; i < (coodCollection.length / 2); i++) {
//snipped
marker.events.register("mouseover", marker,
popupHandler(marker));
}
2013/2/28 dolphintroop <[email protected]>
> Hi,Yves G
>
> Thanks for your suggestion, but the closures inside loops is hard to
> understand for me , could you give me a clear solution based on this code
> section?
> thank you!
>
>
>
> --
> View this message in context:
> http://osgeo-org.1560.n6.nabble.com/why-the-popups-have-same-content-tp5037498p5037571.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> [email protected]
> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users