On Wed, Apr 30, 2008 at 7:14 PM, smartcookie <[EMAIL PROTECTED]> wrote:
>  How do you return the selected index of an array of
>  elementsbyclassname on the element that execute an onclick event?

First thing is you should use select() instead of
getElementsByClassName(), as you will run into problems with browsers
that support the latter natively such as Firefox3.

Here are some examples...

$$('a.link').invoke('onclick'); // call the onclick event for every
link with a class of "link" on the page
$$('html body').select('a.link').first().onclick(); // call the
onclick event for the first link with a class of "link" on the page
$$('html body').select('a.link')[5].onclick(); // call the onclick
event for the 6th link on the page with a class of "link"

-justin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to