I\'ve got a page that retrieves a bunch of locations and some data about their associated markers and puts them on a Google Maps map. Each one is supposed to pop up its own litt
Daff is right about the scope. One alternative, however, is to use bindInfoWindowHtml() instead of a listener with openInfoWindowHtml(). Just replace the listener with this code:
marker.bindInfoWindowHtml(mess);
Replace the listener with
createMarker(marker,mess);
and add the function:
function createMarker(marker, mess) {
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(mess);
});
}
I had this once, too. It is a scoping issue. I had to change my structure a little bit but maybe in your case changing the callback could already help:
GEvent.addListener(marker, "click", function() {
marker.openInfoWindowHtml(pins[i].getElementsByTagName("message")[0].childNodes[0].nodeValue;);
});