On-topic: HTML/JS help please

Gianni Ceccarelli dakkar at thenautilus.net
Fri Feb 5 14:52:15 GMT 2010


On 2010-02-05 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?

<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>Collapse test</title>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.1/jquery.min.js"></script>
  <script type="text/javascript">
   $(document).ready(function() {
    $('td.collapse').bind('click',function() {
     $(this).nextAll().toggle();
     $(this).text( $(this).text()=='+' ? '-' : '+' )
    });
   });
  </script>
 </head>
 <body>
  <table>
   <thead>
    <tr>
     <td>Collapse</td> <td>stuff</td>
    </tr>
   </thead>
   <tbody>
    <tr><td class="collapse">-</td><td>lorem</td></tr>
    <tr><td class="collapse">-</td><td>ipsum</td></tr>
    <tr><td class="collapse">-</td><td>stuf</td></tr>
    <tr><td class="collapse">-</td><td>more</td></tr>
    <tr><td class="collapse">-</td><td>etc</td></tr>
   </tbody>
  </table>
 </body>
</html>

-- 
	Dakkar - <Mobilis in mobile>
	GPG public key fingerprint = A071 E618 DD2C 5901 9574
	                             6FE2 40EA 9883 7519 3F88
	                    key id = 0x75193F88

   Some people are pragmatists, taking things as they come and making
   the best of the choices available. Some people are idealists,
   standing for principle and refusing to compromise. And some people
   just act on any whim that enters their heads. I pragmatically turn
   my whims into principles!  -- Calvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://london.pm.org/pipermail/london.pm/attachments/20100205/ed6366cc/signature.pgp


More information about the london.pm mailing list