Hi, The value of the variable `i` into function of `point.events.register('mouseover'...` is always 1 since the function is executed after finishing the loop.
Xavier Mamano mystic-d wrote > hey > i want to add marker on the map and when the mouse is over on the marker > it will open a popup and show a specific msg (that relevant for the > specific marker), so i used the follwing code : > [code] > var popup = null; > for(var i=0;i<2;i++) > { > if(i==0) > point = new OpenLayers.Marker(new > OpenLayers.LonLat(34.782097,31.976683), icon); > else > point = new OpenLayers.Marker(new > OpenLayers.LonLat(34.784042,31.977528), icon.clone()); > > point.events.register('mouseover',point,function(evt) > { > if(i==0) > popup = new OpenLayers.Popup("chicken",new > OpenLayers.LonLat(34.782097,31.976683),new OpenLayers.Size(50,50),"example > popup1",this,true); > else > popup = new OpenLayers.Popup("chicken2",new > OpenLayers.LonLat(34.784042,31.977528),new OpenLayers.Size(50,50),"example > popup2 ",this,true); > popup.panMapIfOutOfView = true; > map.addPopup(popup); > Event.stop(evt); > } > ); > point.events.register('mouseout',point, function(evt) > { > map.removePopup(popup); > Event.stop(evt); > } > ); > locations_markers_layer.addMarker(point); > } > [/code] > > but its always show me the second popup (the one with the content : > "example popup2 ") , > can someone know what the problem is ? > thanks !! -- View this message in context: http://osgeo-org.1560.n6.nabble.com/how-to-display-another-content-in-another-popup-tp3953412p5037549.html Sent from the OpenLayers Users mailing list archive at Nabble.com. _______________________________________________ Users mailing list us...@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/openlayers-users