On-topic: HTML/JS help please

David Cantrell david at cantrell.org.uk
Fri Feb 5 14:53:27 GMT 2010


On Fri, Feb 05, 2010 at 02:33:17PM +0000, Dermot wrote:
> On 5 February 2010 14:25, David Cantrell <david at cantrell.org.uk> wrote:
> > I want to add a Thingy to CPANdeps to let users collapse/expand portions
> > of the dependency tree.  How would one go about this?
> >
> > Naively wrapping <tr>s in <div>s and toggling their style.display
> > doesn't work, presumably because <div> isn't kosher in a <table>.
> One way would be to <ul> and change the style.display on all it's children.

I'm struggling to imagine what you mean here.  Perhaps it would help if
I show you what I've done so far (which doesn't work).  This represents
a simple dependency tree:

  this::module
    other::module
      yet::another::module
    Test::More

<table>
  <tr>
    <td><a href=javascript:toggle('children_of_this::module')>+</a></td>
    <td>this::module</td>
    <td>blahblahblah</td>
  </tr>
  <div id='children_of_this::module'>
    <tr>
      <td><a href=javascript:toggle('children_of_other::module')>+</a></td>
      <td>other::module</td>
      <td>blahblahblah</td>
    </tr>
  </div>
  <div id='children_of_this::module'>
    <div id='children_of_other::module'>
      <tr>
        <td><a href=javascript:toggle('children_of_yet::another::module')>+</a></td>
        <td>yet::another::module</td>
        <td>blahblahblah</td>
      </tr>
    </div>
  </div>
  <div id='children_of_this::module'>
    <tr>
      <td><a href=javascript:toggle('children_of_Test::More')>+</a></td>
      <td>Test::More</td>
      <td>blahblahblah</td>
    </tr>
  </div>
</table>    

The data in blahblahblah are several columns of a table.  The data
*must* be displayed as a table, and *must* work in any reasonable
browser, including those that don't do CSS - although obviously I don't
expect any fancy stuff like the expanding/collapsing thingy to work in
such primitive browsers.  This is called Degrading Gracefully ;-)

-- 
David Cantrell | even more awesome than a panda-fur coat


More information about the london.pm mailing list