• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

changing the selected row color in javascript

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
In my jsp page i am iterating a collection using <c:forEach> and displaying it in a table as rows.Suppose if i click a row,i want to change the color of the row.How can I do that...
what i know is,
I set the id attribute of each row as the loop goes..and pass the id of the row to a function which is called on onclick.Inside that functin how can give change color code.
function fnsetRow(rowId){
lert("clicked"+rowId);

var table = document.getElementById("listTable"); //this is the table id
var rows = table.getElementsByTagName("tr");
rows[rowId].class="band";
}

but it is not working...what is the problem..help me.
[ June 22, 2006: Message edited by: Bear Bibeault ]
 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
http://www.netmechanic.com/news/vol4/javascript_no20.htm
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi meera u need use to css..so that many thing can be done..in desinging..checkit out..very good example are given here..


http://www.w3schools.com/css/css_reference.asp
 
meera jan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i got it working..thanx alot.
 
meera jan
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
i have one more doubt to clear.
what i am using is the getElementById method(refer my previous post).But i think it won't work with Mozilla.Is there any alternative which works in all browsers...
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please post HTML and Javascript questions in the appropriate forum. Moved to the HTML forum.
 
To do a great right, do a little wrong - shakepeare. twisted little ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic