Thanks for the swift reply!
Here is the way i load the xml and create the markers.
GDownloadUrl("genxml.php", function(data) {
var xml = GXml.parse(data);
var markers = xml.documentElement.getElementsByTagName("marker");
for (var i = 0; i < markers.length; i++) {
var id = markers[i].getAttribute("id");
var type = markers[i].getAttribute("type");
var status = markers[i].getAttribute("status");
var img = markers[i].getAttribute("img");
var point = new
GLatLng(parseFloat(markers[i].getAttribute("lat")),
parseFloat(markers[i].getAttribute("lng")));
var marker = createMarker(point, id, type, status, img);
map.addOverlay(marker);
}
});
function createMarker(point, id, type, status, img) {
var marker = new GMarker(point, customIcons[status]);
var html = "<h2> id: " + id + "</h2> <b> Fejltype = </b>" + type +
"<br/> <b> Status = </b>" + status + "<br/>;
GEvent.addListener(marker, 'click', function() {
marker.openInfoWindowHtml(html);
});
return marker;
On 13 Dec., 14:01, Rossko <[email protected]> wrote:
> > Is it possible to retrieve the markers id attribute when it is
> > clicked?
>
> Probably. Did you assign a custom id attribute when you created the
> marker? I would recommend not using marker.id as other things might
> also use that ... perhaps something like marker.my_id
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api?hl=en.