On Sep 16, 10:31 am, Dan Burnette <[email protected]> wrote:
>  can add a line on the map using GPolyline.  I am having the hardest
> time removing it.
>
> I want to have a radio button that will show the lines and I want it
> to toggle on and off.
>
> I have simplified my code but when I run it in a map, it never deletes
> the line.  In fact, it never drops to my final alert box "just
> executed" either.

Pretty much the same thing I'm doing on my map.  This is the
simplified version: I have an array that has all the bits and pieces I
need, including the polyline's vertex points.  I have a routine that
calls either map.addOverlay(polyline) or map.removeOverlay(polyline)
based on a status variable.  And my checkbox (not radio button) calls
the toggle function like so:

<input type="checkbox" id="polyline_1" onclick="(this.checked) ? toggle
('polyline_1', 1) : toggle('polyline_1', 0);"> Toggle polyline

Things to keep in mind:
  your function needs to set the checkbox status each time you call it
(document.getElementById(rOverlay).checked = [FALSE or TRUE]; )
  If you're adding an event listener to your polyline, it needs to
happen outside of the toggle function for proper closure.

See example here: http://dev.thekirchners.net/routetest.html

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