diff options
-rw-r--r-- | src/usr/local/www/firewall_rules.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php index 38b0fb4..6d2e94e 100644 --- a/src/usr/local/www/firewall_rules.php +++ b/src/usr/local/www/firewall_rules.php @@ -698,19 +698,23 @@ function fr_toggle(id, prefix) { fr_bgcolor(id, prefix); } +// Change background color based on state of checkbox +// On resetting background, reapply table striping function fr_bgcolor(id, prefix) { if (!prefix) prefix = 'fr'; - var row = document.getElementById(prefix + id); - var checkbox = document.getElementById(prefix + 'c' + id); - var cells = row.getElementsByTagName('td'); - var cellcnt = cells.length; + var row = $('#' + prefix + id); - for (i = 0; i < cellcnt-1; i++) { - cells[i].style.backgroundColor = checkbox.checked ? "#DDF4FF" : "#FFFFFF"; + if ($('#' + prefix + 'c' + id).prop('checked') ) { + row.css("background-color", "#DDF4FF"); + row.removeClass('active'); + } else { + row.css("background-color", "#FFFFFF"); + $("tr:odd").addClass('active'); } } + </script> <script> |