WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 sortable table + dynamic cell colouring?, joshua, May 28, 2005
     Re:sortable table + dynamic cell colouring?, Erik Arvidsson, June 5, 2005

Subject: sortable table + dynamic cell colouring? From: joshua Date: May 28, 2005
is there anyway to integrate the sortable table with this:

<script type="text/javascript">
function hasClass(obj) {
var result = false;
if (obj.getAttributeNode("class") != null) {
result = obj.getAttributeNode("class").value;
}
return result;
}
function stripe(id) {
var even = false;
var evenColor = arguments[1] ? arguments[1] : "#fff";
var oddColor = arguments[2] ? arguments[2] : "#eee";
var table = document.getElementById(id);
if (! table) { return; }
var tbodies = table.getElementsByTagName("tbody");
for (var h = 0; h < tbodies.length; h++) {
var trs = tbodies[h].getElementsByTagName("tr");
for (var i = 0; i < trs.length; i++) {
if (!hasClass(trs[i]) && ! trs[i].style.backgroundColor) {
var tds = trs[i].getElementsByTagName("td");
for (var j = 0; j < tds.length; j++) {
var mytd = tds[j];
if (! hasClass(mytd) && ! mytd.style.backgroundColor) {
mytd.style.backgroundColor = even ? evenColor : oddColor;
}
}
}
even = ! even;
}
}
}
</script>

?

if you could, you wouldn't need to name the rows .even and .odd.



Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX