Hi,
I am only new to google maps and I am having a problem with the
following code. I would really appreciate it if anyone can help me.
It's pretty basic stuff, because want to get two markers working
before i get xml data from my database.

This is the script i am using to create the markers and get the
information off the xml file test2.xml.

**********************************************************************************************
    <script type="text/javascript">

    //<![CDATA[

        //Load function

        var map;

        function load() {
            if (GBrowserIsCompatible()) {
            map = new GMap2(document.getElementById("map"));
            map.addControl(new GSmallMapControl());
            map.addControl(new GMapTypeControl());
            map.setCenter(new GLatLng
('53.33863778587094','-6.313619613647461'), 16);

            // Read the data from test2.xml
            GDownloadUrl("test2.xml", function(doc) {

            var xml = GXml.parse(data);
                                var markers =
xml.documentElement.getElementsByTagName("marker");
                                for (var i = 0; i < markers.length; i++)
                                {
                                    var name = markers[i].getAttribute("name");
                                    var address = markers[i].getAttribute
("address");
                                    var phone= markers[i].getAttribute("phone");
                                    var openingHours = markers[i].getAttribute
("openingHours");
                                    var email = 
markers[i].getAttribute("email");
                                    var point = new GLatLng(parseFloat(markers
[i].getAttribute("lat")),parseFloat(markers[i].getAttribute("lng")));
                                    var marker = createMarker(point, label, 
address,
phone, openingHours, email);
                                        map.addOverlay(marker);
                                }
                            });
                    }
                }

                function createMarker(point, label, address, phone, 
openingHours,
email)
                {
                    var marker = new GMarker(point);
                    var html = "<b>" + label + "</b> <br/>" + address + "<br 
/>" +
phone + ", " + openingHours + " " + email;
                    GEvent.addListener(marker, 'click',function()
{marker.openInfoWindowHtml(html);});
                    return marker;
                        }

//]]>
</script>
*******************************************************************************************
Here is the xml file....

<markers>
<marker name="Chemist1" address="123" phone="000" openingHours="9 to
5" email="[email protected]" lng="-6.32082000" lat="53.339600" />
<marker name="Chemist2" address="321" phone="111" openingHours="9 to
5" email="[email protected]" lng="-6.32036000" lat="53.340000" />
</markers>

*******************************************************************************************

I apologies it this code is pretty basic but I cannot see the problem
with it, i think i have been looking at it too much and the solution
is probably simple enough. :)

Thank you


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to