On Jul 14, 10:41 pm, Mike <[email protected]> wrote:
> Wow, I am sorry, but I do not have enough skill to extrapolate what I
> need from these examples and implement in my code.. :(
> I tried a few different things, but cant get it to work.
>
> Here is what I have:
Where is your map?
I still don't see a createMarker function to give you function closure
on your markers...
What is the handleMarkerClick function? (not an invitation to post
more code, just an indication that posting code tends to leave out
important information...)
-- Larry
> ________________________________
> <script type="text/javascript">
> var map;
> function initialize() {
> var myLatlng = new google.maps.LatLng(39.900000, -75.078506);
> var myOptions = {
> zoom: 8,
> center: myLatlng,
> mapTypeId: google.maps.MapTypeId.ROADMAP
> }
> map = new google.maps.Map(document.getElementById("map_canvas"),
> myOptions);
> downloadUrl("data.xml", function(data) {
> var markers =
> data.documentElement.getElementsByTagName("marker");
> for (var i = 0; i < markers.length; i++)
> {
> var bubbletext = "<p>"+ markers[i].getAttribute("club") +" ::
> "+ markers[i].getAttribute("phone") +" -"+
> markers[i].getAttribute("stat") +"</p>";
> var latlng = new
> google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(ma
> rkers[i].getAttribute("lng")));
> var infowindow = new google.maps.InfoWindow({content:
> bubbletext});
> var marker = new google.maps.Marker({position: latlng, map:
> map});
> google.maps.event.addListener(marker, 'click',
> handleMarkerClick(marker, i));
> google.maps.event.addListener(
> marker, "click", function() {
> infowindow.open(map, marker);
> });
> }
> });
> }
> </script>
> __________________________
>
> -Mike
>
> On Jul 13, 11:29 pm, Chad Killingsworth
>
>
>
> <[email protected]> wrote:
> > Larry is correct in that it is a closure problem. Take a look at
> > Daniel's write up of the issue and see if that makes things
> > clearer:http://groups.google.com/group/google-maps-js-api-v3/browse_thread/th...
>
> > Chad Killingsworth
>
> > On Jul 13, 10:20 pm, Mike <[email protected]> wrote:
>
> > > Thanks for the reply Larry, but not really. I am confused by this
> > > unroll stuff :/
>
> > > On Jul 13, 10:57 pm, "[email protected]" <[email protected]>
> > > wrote:
>
> > > > On Jul 13, 7:42 pm, Mike <[email protected]> wrote:
>
> > > > > Hi,
>
> > > > > I have a map with multiple markers loading from XML.
>
> > > > > The markers load properly, but no matter which marker I click, the
> > > > > same bubble pops up on the same marker.
>
> > > > You aren't getting function closure on the markers.
> > > > Pitfall number 3 on Mike Williams' (v2) Tutorial:
> > > > The Basics - Part 1 Markers with info
> > > > windowshttp://econym.org.uk/gmap/basic1.htm
>
> > > > > Here is my loop:
> > > > > =====================
>
> > > > > var markers =
> > > > > data.documentElement.getElementsByTagName("marker");
> > > > > for (var i = 0; i < markers.length; i++)
> > > > > {
> > > > > var bubbletext = "<p>"+ markers[i].getAttribute("club") +" ::
> > > > > "+ markers[i].getAttribute("stat") +"</p>";
> > > > > var latlng = new
> > > > > google.maps.LatLng(parseFloat(markers[i].getAttribute("lat")),parseFloat(ma
> > > > > rkers[i].getAttribute("lng")));
> > > > > var infowindow = new google.maps.InfoWindow({content:
> > > > > bubbletext});
> > > > > var marker = new google.maps.Marker({position: latlng, map:
> > > > > map});
> > > > > google.maps.event.addListener(
> > > > > marker, "click", function() {
> > > > > infowindow.open(map, marker);
> > > > > });
> > > > > }
> > > > > });
>
> > > > > =====================
>
> > > > > Any help would be appreciated.
>
> > > > Does this help:http://www.geocodezip.com/v3_MW_example_map3.html
>
> > > > -- Larry
>
> > > > > Thanks, Mike
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" 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-js-api-v3?hl=en.