Does this work too?

function createMarker(point, marker_id, act_id, html) {
  var marker = new GMarker(point,gicons[act_id]);
  var infoDiv = document.createElement('div');
        infoDiv.innerHTML = html;
        enableStars(infoDiv, marker_id);
        marker.bindInfoWindow(infoDiv,{onOpenFn: function()
{markerHit(marker_id); }});
  return marker;
}

Martin.


On 27 Apr, 21:39, Brian Kerr <[email protected]> wrote:
> SOLVED: here is the final way using bindInfoWindow (for ajax calls,
> mine is enableStars() ) and addListener and passing a var about the
> marker (marker_id), note I had to construct the function INSIDE of
> addListener, for some reason I could not call an outside function.
>
> var marker = new GMarker(point,gicons[act_id]);
>   var infoDiv = document.createElement('div');
>         infoDiv.innerHTML = html;
>         enableStars(infoDiv, marker_id);
>         marker.marker_id = marker_id;
>         marker.bindInfoWindow(infoDiv);
>         GEvent.addListener(marker, "infowindowopen", function(marker)
> {alert('you clicked marker'+marker.marker_id);});
> return marker;
>
> On Apr 27, 1:06 pm, Brian Kerr <[email protected]> wrote:
>
>
>
> > NOTE to others who must use bind:
>
> > marker.bindInfoWindow(infoDiv,{onOpenFn: markerHit});
> > Will not call the function for some reason, instead I had to add a
> > listener.
>
> > marker.bindInfoWindow(infoDiv);
> > GEvent.addListener(marker, "infowindowopen", markerHit);
>
> > On Apr 27, 12:44 pm, Rossko <[email protected]> wrote:
>
> > > > It was pretty apparent that was happening... I just hoped there was a
> > > > little easier way to go about it. Any quick tip on how to snag what
> > > > marker was clicked from the function?
>
> > > I'm not at all familiar with bindings, I would go at it some other way
> > > to get function closure.  What would 'this' be in the context, the
> > > infowindow?   Perhaps someone else can advise.
>
> > > --
> > > 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 
> > > athttp://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 
> > athttp://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 
> athttp://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