Hi i have many markers on my map, and they all show up fine. However, once I
register the click event to every marker, I face another problem. Please
see the code below. Once I click on the markers, the popup will show up but
the information inside the popup is wrong, it will show the same name all
the time.
Could someone please help me solve the problem?
I look forward to hearing from you as soon as possible.
Many thanks
Seak Meng Lay
function makemarker(){
var markersLayer = new OpenLayers.Layer.Markers("Oil Wells");
var iconSize = new OpenLayers.Size(20,20);
var iconOffset= new
OpenLayers.Pixel(-(iconSize.w/2),-iconSize.h);
for(var i=0; i<places.length;i++){
var place = places[i];
var marker= new OpenLayers.Marker(new
OpenLayers.LonLat(place.y,place.x),
new
OpenLayers.Icon('http://www.projectliberty.org/var/liberty/storage/images/files/images/icons/oil_icon/24263-1-eng-US/oil_icon_small.jpg',iconSize,iconOffset));
markerattribute = new Array();
markerattribute[0] = place.name;
markerattribute[1] = marker;
markersLayer.addMarker(markerattribute[1]);
marker.events.register("mousedown",markerattribute[1],
mousedown);
}
map.addLayer(markersLayer);
}
function mousedown(evt){
testPopup= new OpenLayers.Popup("details", new
OenLayers.LonLat(this.lonlat.lon,this.lonlat.lat),new
OpenLayers.Size(200,200), markerattribute[0] , true);
map.addPopup(testPopup,true);}
--
View this message in context:
http://www.nabble.com/problem-with-popups-once-a-marker-is-clicked-tp17737221p17737221.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users