Hi Larry,
Ok, I was misunderstanding the documentation for the click events.
It turns out the correct syntax is as follows:
GEvent.addListener(poly0, 'click', function(point) { var myHTML = "<a
href='#' onClick='showPlace(9772)'>84-32</a>"; map.openInfoWindowHtml
(point, myHTML);});
I was adding the event listener directly to the map, not the shape;
adding the listener to the shape, and removing the reference to the
shape in the inner function cleared it up.
Thanks!
-Steve
On Mar 24, 1:54 pm, "[email protected]" <[email protected]>
wrote:
> On Mar 24, 1:27 pm, Steve <[email protected]> wrote:
>
>
>
> > Hello,
>
> > I have a page athttp://ari.asu.edu/AZSitethatdisplays points,
> > lines, and polygons from a MySQL Spatial database, loaded onto the map
> > via an Ajax call (click the link shown below the map to see what the
> > Ajax call returns, and then view source to see it as sent from the
> > browser).
>
> > Each shape is given a listener on the click event, which is
> > supposed to open the info balloon and display a short message. The
> > message is a link that executes the showPlace function (that for now
> > just does an alert, but will run another Ajax call that will populate
> > the green area on the screen with info from the MySQL database for the
> > record ). The listeners take this form:
>
> > GEvent.addListener(map, 'click', function(point0, point) { var myHTML
> > = "<a href='#' onClick='showPlace(9772)'>84-32</a>";
> > map.openInfoWindowHtml(point, myHTML);});
>
> > Currently, when the user click on any of the shapes, An error is
> > thrown from line 554 in the API script (not my script), that says,
> > 'undefined' is null or not an object.
>
> > What's the cause of this error? I suspect it's something in my Ajax
> > call that's returning impropoerly set up shapes, but can't quite
> > figure it out.
>
> > Thanks,
>
> Not sure, but
> GEvent.addListener(map, 'click', function(poly3, point) { var myHTML =
> "72-1"; map.openInfoWindowHtml(point, myHTML);}); addLabel
> (36.94208,-113.49693," 72-1 ", "plabel");
>
> The map click listener will return either a overlay or a point, not
> both. If you click on a polygon, the point argument will be null.
>
> http://code.google.com/apis/maps/documentation/reference.html#GMap2.c...
>
> -- Larry- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---