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.
Dp.
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<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) {
alert(Tbl.rows[num].cells[i]);
Tbl.rows[num].cells[i].style.display = 'none';
}
}
</script>
</head>
<body>
<table id="mytable" border="1">
<tr>
<td><a href="javascript:toggle(0)">+</a></td>
<td>this::module</td>
<td>blahblahblah</td>
</tr>
<tr>
<td><a href="javascript:toggle(1)">+</a></td>
<td>other::module</td>
<td>blahblahblah</td>
</tr>
<tr>
<td><a href=javascript:toggle(2)>+</a></td>
<td>yet::another::module</td>
<td>blahblahblah</td>
</tr>
<tr>
<td><a href=javascript:toggle(3)>+</a></td>
<td>Test::More</td>
<td>blahblahblah</td>
</tr>
</table>
</body>
</html>
More information about the london.pm
mailing list