From 80cf44e9c9fac8f36420cd776bbee4b59bb915f0 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Tue, 25 Oct 2005 16:58:46 +0000 Subject: MFC 7147 Dynamically figure out the number of 'frd' cells in a table This allows for different sized tables to use the row moving JS without looking ugly --- usr/local/www/row_toggle.js | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'usr/local/www/row_toggle.js') diff --git a/usr/local/www/row_toggle.js b/usr/local/www/row_toggle.js index 1ae9240..0e7a786 100755 --- a/usr/local/www/row_toggle.js +++ b/usr/local/www/row_toggle.js @@ -24,28 +24,31 @@ function fr_insline(id, on) { var prevrow = document.getElementById('frheader'); } - var cells = row.getElementsByTagName("td"); + var cells = row.getElementsByTagName("td"); var prevcells = prevrow.getElementsByTagName("td"); - - for (i = 2; i <= 7; i++) { - if (on) { - prevcells[i].style.borderBottom = "3px solid #990000"; - prevcells[i].style.paddingBottom = (id != 0) ? 2 : 3; - } else { - prevcells[i].style.borderBottom = "1px solid #999999"; - prevcells[i].style.borderBottomWidth = "1px"; - prevcells[i].style.paddingBottom = (id != 0) ? 4 : 5; + + for (i = 0; i <= prevcells.length - 1; i++) { + if (prevcells[i].id == 'frd' + (id-1)) { + if (on) { + prevcells[i].style.borderBottom = "3px solid #990000"; + prevcells[i].style.paddingBottom = (id != 0) ? 2 : 3; + } else { + prevcells[i].style.borderBottom = "1px solid #999999"; + prevcells[i].style.borderBottomWidth = "1px"; + prevcells[i].style.paddingBottom = (id != 0) ? 4 : 5; + } } } - for (i = 2; i <= 7; i++) { - if (on) { - cells[i].style.borderTop = "2px solid #990000"; - cells[i].style.paddingTop = 2; - } else { - prevcells[i].style.borderBottom = "1px solid #999999"; - cells[i].style.borderTopWidth = 0; - cells[i].style.paddingTop = 4; + for (i = 0; i <= cells.length - 1; i++) { + if (cells[i].id == 'frd' + (id)) { + if (on) { + cells[i].style.borderTop = "2px solid #990000"; + cells[i].style.paddingTop = 2; + } else { + cells[i].style.borderTopWidth = 0; + cells[i].style.paddingTop = 4; + } } } } -- cgit v1.1