On-topic: HTML/JS help please

Dermot paikkos at googlemail.com
Fri Feb 5 16:05:12 GMT 2010

On 5 February 2010 15:41, David Cantrell <david at cantrell.org.uk> wrote:
> On Fri, Feb 05, 2010 at 03:14:51PM +0000, Bob MacCallum wrote:
>> <tr style="display: none" id="xyz">
>> has worked for me in the past.  why do you need to wrap it in a div?
>> is it not standards compliant?
> Because on this page, for example:
>  http://deps.cpantesters.org/?module=Data::Compare;perl=latest
> the row for Test::More needs to disappear if I collapse the tree for
> either File::Find::Rule or Data::Compare.  So I tried wrapping each row
> in several <div>s, one for each of the needed ids.

I like Gianni method personally.  It's far more shiny. But here's my
effort anyway. This just collapses. You'll need to determine the
current style and act accordingly.

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
 <title>Collapse test</title>

 <script type="text/javascript">
   function toggle(num) {
       var Tbl = document.getElementById('mytable');
        var i;
        for (i = 1; i < Tbl.rows[num].cells.length; ++i) {
            Tbl.rows[num].cells[i].style.display = 'none';
<table id="mytable" border="1">
   <td><a href="javascript:toggle(0)">+</a></td>
     <td><a href="javascript:toggle(1)">+</a></td>
       <td><a href=javascript:toggle(2)>+</a></td>
     <td><a href=javascript:toggle(3)>+</a></td>

More information about the london.pm mailing list