I have a table which is filled from several jsp pages.
I wanna alternate the table <tr>
background after the page is loaded.
I have to call this script:
function alternate(id){
var table = document.getElementById(id);
var rows = table.getElementsByTagName("tr");
for(i = 0; i < rows.length; i++){
if(i % 2 == 0){
rows[i].style.backgroundColor = "#84939a";
}else{
rows[i].style.backgroundColor = "#FFFFFF";
}
}
}
How can I do that? Thanks in advance