On Apr 23, 7:20 pm, admhays <[email protected]> wrote:
> I have managed to create the marker but nothing happens when I click
> on it. Just need a simple info window and I will go from there thx!
The problem with
var jeanette = new GLatLng(39.2279, -94.6284 );
GEvent.addListener(jeanette, "click", function() {
GMarker.openInfoWindowHtml("Some stuff");});
map.addOverlay(new GMarker(jeanette))
is that jeanette is a GLatLng, not a GMarker. You need to add your
listener to a marker. And it needs to be a specific marker, not the
GMarker class.
What you could do is
// define a place
var jeanettePlace = new GLatLng(39.2279,-94.6284);
// define a marker at that place
var jeanetteMarker = new GMarker(jeanettePlace);
// add it to the map
map.addOverlay(jeanetteMarker);
// define an event for that marker
GEvent.addListener(jeanetteMarker,"click",function() {
// when the event is triggered, open the marker's infoWindow
jeanetteMarker.openInfoWindowHtml("Some stuff");});
Note: this is not the best way of doing things. Mike has a better way
using a createMarker function in his tutorial at
http://www.econym.org.uk/gmap/basic1.htm
Andrew
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---