Titan9999 wrote:
> Hi everyone,
>
> I recently started using Prototype and think it's a great library. It
> makes writing Javascript more fun. :)
>
> I wrote some simple code that highlights a table row when a check box
> in the row is checked.
> The code works fine in FireFox, but when I tested in IE6, the behavior
> is strange. In IE6, the first time I click a checkbox, no row gets
> highlighted. Then when I click the next checkbox, the previous row now
> gets selected.
>
> I have these codes:
>
>     $('myForm').getInputs('checkbox', 'items').each(function(item) {
>       item.observe('change', highlightRow);
>     })
>
> My highlightRow function is as follows:
>
> function highlightRow(event) {
>    event.element().up('tr').toggleClassName('selectedRow');
>     //event.findElement('tr').toggleClassName('selectedRow');
> }
>
> I also tried getting the row using findElement, but same result in
> IE6.
>
> Could someone help me fix the problem? Thanks.
>   
Try using the 'onclick' event instead of the 'onchange' event.  IE fires 
the onchange event in checkboxes only when focus is shifted elsewhere.

see http://www.quirksmode.org/dom/events/change.html

- Ken Snyder


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