> GEvent.addListener(map, 'click', function( overlay, latlng ){
...
> console.log(latlng.lat());
> when i click the marker, it give me an error: "latlng is undefined"
Yes. The map click listener will return an overlay if an overlay is
clicked, or a latlng if the bare map is clicked, but NOT both.
If you want to use the latlng when an overlay (your marker) is
clicked, you probably want to look into the third parameter. This
thread could be useful -
http://groups.google.com/group/Google-Maps-API/browse_thread/thread/d58a609f616e396e/2bdcb4340b4dfcae?lnk=gst&q=click+marker+event+third#2bdcb4340b4dfcae
Don't forget, when you have created an infowindow, that's a clickable
overlay too. You might need to modify your code to deal with that.
cheers, Ross K
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---