On Jan 31, 4:00 pm, xhan <[email protected]> wrote:
> Hi guys,
>
> I'm stuck trying to add markers from xml. It works fine until I want
> to open an info window, this is the offending code!
>
> GDownloadUrl("includes/gmaps/notes.php", function(data) {
> var xml = GXml.parse(data);
> var markers = xml.documentElement.getElementsByTagName("marker");
> for (var i = 0; i < markers.length; i++) {
> var point = new GLatLng(parseFloat(markers[i].getAttribute
> ("lat")),
> parseFloat(markers[i].getAttribute
> ("lng")));
>
> var html = markers[i].getAttribute("html");
> // create the marker
> var shownotemarker = createMarker(point,html);
>
> //var shownotemarker = new GMarker(point,
> {icon:orangeIcon, draggable: true});
> map.addOverlay(shownotemarker);
> shownotemarker.disableDragging();
> }
>
> });
> }
>
> function createMarker(point,html) {
> var shownotemarker = new GMarker(point, {icon:orangeIcon, draggable:
> true});
> GEvent.addListener(shownotemarker, "click", function() {
> shownotemarker.openInfoWindowHtml(html);
> });
// shownotemarker needs to return the created marker
return(shownotemarker);
>
> }
>
> This code works if I use the commented out line.
>
> var shownotemarker = new GMarker(point, {icon:orangeIcon, draggable:
> true});
>
> but not when I use the createMarker function, which I need to be able
> to display the infowindow
>
> as far as I can see it should work!?
>
> the code is live here:http://www.the-community-project.co.uk/main/local.php
>
> Thank you for your help :)
Currently the shownotemarker function doesn't return anything and the
map.addOverlay() functions when it tries to add an undefined object to
the map.
-- Larry
--
You received this message because you are subscribed to the Google Groups
"Google Maps API" 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.