Forum Moderators: coopster
Here's some code I lifted directly from one of my scripts, messy but works, that might get you started:
echo ' <img src="i/plus.gif" style="cursor: pointer;" onclick="document.getElementById(\'row'.$i.'\').style.display=\'block\'; this.style.display=\'none\';" alt="show" title="show script info" id="plus'.$i.'">';
echo '<div id="row'.$i.'" style="display: none;">';
echo '<img src="i/minus.gif" style="cursor: pointer;" onclick="document.getElementById(\'row'.$i.'\').style.display=\'none\'; document.getElementById(\'plus'.$i.'\').style.display=\'inline\';" alt="hide" title="hide script info"> ';
Basically you make this part of your table-producing script, and with each row you increment $i, you make it do the code above, and then you output the content that you want hidden unless clicked, followed by a closing </div>. I just basically cut this out of the script so it might not work without tweaking, but if you are a bit familliar with js, it might give you the basic idea.
If you get more advanced in javascript you can actually attach events to specific elements so your HTML doesn't look so aweful as this; cleanier and nicer, but much more complicated programming.
If you go down this road, send your further questions to the javascript forum.
Welcome to WebmasterWorld, jortworx.
Btw. if you use the above code you'll want to put the whole thing inside a div so you can make the content initially hidden- eg.
<div id="hiddenpart">
(stuff here)
</div>
and in your css:
div #hiddenpart div {
display: none;
}