Javascript onclick for thumbnails

Hi,

i was struggling for a function where only 1 thumbnail should be active
and others inactive when clicked on the particular thumbnail.
code:

  1. view:
  2.         <% for eligible_exercise in excercises %>
    
  3.    <% exercise = eligible_exercise.exercise %>
    
  4.   <div onclick="PlayVideo_options('<%= exercise.path_to_video
    
  5. %>’, ‘active_<%= exercise.id %>’)" class=“video_option” id=“active_<%=
    exercise.id %>”>
    12.


    13.

14. <% end %>
15.

what i want is, when user clicks on 1st thumbnail the class should
become ‘video_option active_video’.And when clicks on 2nd thumbnail, the
2nd thumbnail should become ‘video_option active_video’ and the 1st
thumbnail should become ‘video_option’

Means there should be only 1 thumbnail in class=“video_option
active_video” state when clicked and others in class=“video_option”
and i was getting all active when clicked using above function

thanks in advance !!

On 30 Jun 2008, at 15:21, Srinath A. wrote:

and i was getting all active when clicked using above function

Read up on prototype’s $$, addClassName and removeClassName functions
(on prototypejs.org)

Fred