The distinction between id and class is that there should only be one element per page with a particular id but you could have one or more elements with the same class.
What you could do is find all the elements that have the class row and then iterate to observe each with the following syntax: $$('.row') gets all the elements. Then you can iterate on them. You can call .size() and reference the collection at a particular index with $$('.row')[i]. Then attach your observers to each one of those. On Dec 11, 2:37 pm, Russell <rkeith2...@gmail.com> wrote: > I have a table with 12 rows with an id of row. The following code > works great for the first row but not the following rows. How can I > make this work without creating both entries 12 times. > > <script type="text/javascript"> > Event.observe(window, 'load', function() { > $('row').observe( 'mouseover', function(event) { $('row').addClassName > ('hover'); }); > $('row').observe( 'mouseout', function(event) { $ > ('row').removeClassName('hover'); }); > > }); --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---