Is there a way to get rid of the "onclick" here and just set the highlight if the book.title == session[:book][:title]? The javascript works fine for the onclick, but I want to highlight when the page loads... <% @books_by_subject.each do |book| %> <% if book.title == session[:book][:title] %> <tr onClick="HighLightTR(this,''#7C3C3C'',''#000000'');"><td><a href="/chapters<%= book.id %>"><%= book.title %></a></td> </tr> <% else %> <tr><td><a href="/chapters/<%= book.id %>"><%= book.title %></a></td> </tr> <% end %> <% end %> Thanks, Dave -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Or is there a better way to highlight without using java script? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
write it in document.ready function -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Apr 10, 3:12 am, Dave Castellano <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Or is there a better way to highlight without using java script? > > -- > Posted viahttp://www.ruby-forum.com/.CSS? <% @books_by_subject.each do |book| %> <% if book.title == session[:book][:title] %> <tr id=''highlighted-row''><td><a href="/chapters<%= book.id %>"><%= book.title %></a></td> </tr> <% else %> <tr><td><a href="/chapters/<%= book.id %>"><%= book.title %></a></td> </tr> <% end %> <% end %> Then set the CSS style for #highlighted-row. If you want to highlight multiple rows, you could use a class instead of an ID to identify each row to be highlighted. Paul -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.