On Nov 1, 9:08 pm, xelawho <[email protected]> wrote:
> > This is the code in the sidebar generates a click event on the
> > polyline:
> >         label = "<a href='javascript:GEvent.trigger(gpolys["+poly_num
> > +"],\"click\");'>"+label+"</a>";
>
> Thanks, Larry... but I guess this is the bit that's confusing me
> - my limited understanding is that if, following the example
> given, I add this to the createClickablePolyline function:
>
> var poly_num = gpolylines.length - 1;
>
> then use a link like:
> <a href='javascript:GEvent.trigger(gpolylines["+poly_num+"],\"click
> \");'>Blue line</a>

That will only work if you do it in the createClickablePolyline
function and dynamically create the link inside the function.

If you do it outside of that function gpolylines.length-1 will always
point to the last polyline in your xml (or be zero).

gpolylines[0] will always be the first polyline in your xml.
gpolylines[1] will always be the second polyline, etc.

If you don't want to count on the order of the xml, you can change the
gpolylines array (or create new array) to be an associative array
indexed with an "id" that you define in your xml.

  -- Larry


>
> then it should work...
>
> but the link info at the bottom left there in firefox tells me that
> "+poly_num+" is not getting substituted for a number (as it does in
> your working example, Larry) and the error console tells me that the \
> in \"click\" is illegal.
>
> so I'm obviously leaving out some important bit of code, but being
> that I'm trying not to create a dynamically generated sidebar (rather
> have a set of static links) I can't see what I'm missing out on, or if
> I can in fact do this.
>
> any ideas HUGELY appreciated.
>
> Lucas

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" 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