On Nov 16, 11:15 am, Mike <[email protected]> wrote:
>  I did read the posting guidelines, but as I said, I don't have it
> live yet.
> I was hoping one of the friendly experts here might see something in
> the code that I was missing.
>
> Larry, I also looked at that link, and I don't see how it relates.

What link?  The answer to your problem is in Mike Williams' v2
tutorial.  The tutorial is for v2, but the javascript concept that is
causing your problem is applicable.

>From Mike Williams' (v2) tutorial:

The Basics - Part 1 Markers with info windows

http://econym.org.uk/gmap/basic1.htm


Potential Pitfalls

<snip>
=========================================================
3.    Don't attempt to "unroll" the createMarker() function. This
doesn't work.

          var point = new GPoint(-79.90138, 43.65654);
          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml("Some stuff");
          });
          map.addOverlay(marker);

          var point = new GPoint(-78.89231, 43.91892);
          GEvent.addListener(marker, "click", function() {
            marker.openInfoWindowHtml("Some other stuff");
          });
          map.addOverlay(marker);


    What goes wrong is that there's only one copy of the "marker"
variable. When the "click" event gets triggered at a later time, it
gets the value that's in the variable at the time of the call, but you
want the value at the time the event handler was set up.
=========================================================

  You can fix it with function closure (Mike's examples use that, a
"createMarker" function), there are other ways as well.

  -- Larry

>
> Thanks,
> Mike
>
> On Nov 16, 2:04 pm, "[email protected]" <[email protected]>
> wrote:
>
>
>
>
>
>
>
> > On Nov 16, 10:50 am, Mike <[email protected]> wrote:
>
> > > Hi,
> > > I am having an issue with the same infowindow popping up no matter
> > > what marker is clicked. I know similar questions have been asked
> > > before, but their code doesn't look all that similar to mine.
>
> > > Here is my code (sorry i don't have a live example yet).
>
> > Bummer.
>
> > > A couple notes:
> > > * The JSON i am reading is fine, i see all the values
> > > * I see this error in firebug: 'Invalid value for property <content>:
> > > [object Object]'
>
> > Please read and follow the posting guidelines.  Provide a link to your
> > map if you would like help.
>
> > > Thanks in advance for any help!
>
> > Search for pitfall #3
>
> >http://groups.google.com/group/google-maps-js-api-v3/search?group=goo...
>
> >   -- Larry
>
> > > -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.

Reply via email to