Skip to content

Instantly share code, notes, and snippets.

@EnigmaCurry
Created October 21, 2009 19:08
Show Gist options
  • Save EnigmaCurry/215354 to your computer and use it in GitHub Desktop.
Save EnigmaCurry/215354 to your computer and use it in GitHub Desktop.
function alternate(id){
if(document.getElementsByTagName){
var table = document.getElementById(id);
var rows = table.getElementsByTagName("tr");
for(i = 0; i < rows.length; i++){
if(i % 2 == 0){
rows[i].className = "even";
}else{
rows[i].className = "odd";
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment