Yea instead of:
map.addOverlay(new GMarker(point1));

Create a variable for your marker
var Marker = new GMarker(point1);
map.addOverlay(Marker);

Then do:
GEvent.addListener(Marker, "click", function(){
   function goes here
});

That should get you up and running.

On Wed, Aug 11, 2010 at 12:21 PM, [email protected] <[email protected]
> wrote:

> On Aug 11, 9:50 am, pubbtaf <[email protected]> wrote:
> > I've a map with same markers over. I wish that when mouse click over
> > one of these points the browser redirect to a custom page.
> > I post the code below, but doesn't work. Could anyone help?
> >
> >     function initialize() {
> >       if (GBrowserIsCompatible()) {
> >         var map = new GMap2(document.getElementById("map_canvas"));
> >         map.setCenter(new GLatLng(41.191400,15.11800), 11);
> >         map.setUIToDefault();
> >                 var bounds = map.getBounds();
> >             var point1 = new GLatLng(41.152519,15.08758);
> >                 map.addOverlay(new GMarker(point1));
> > ....
> >                 GEvent.addListener(point1, "click", function() {
> >                 alert("You clicked me");
> >                 location.href = "http://www.indirizzo_pagina.it?id=1";;
> >                 });
> >                 }
> >         }
>
> var point1 = new GLatLng
> GEvent.addListener(point1, "click", function() {
>
> GLatLngs don't have click events.  You need to keep a reference to a
> GMarker and add the click listener to that.
>
>  -- Larry
>
> --
> 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]<google-maps-api%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-maps-api?hl=en.
>
>

-- 
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.

Reply via email to