/ Published in: JavaScript

Show Hide table data uses href, anchors, div tags, and javascript to toggle between showing and hiding a table on the html page.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> <!-- function switchView(obj) { var el = document.getElementById(obj); if ( el.style.display != "none" ) { el.style.display = 'none'; } else { el.style.display = ''; } } //--> </script> <table> <tr> <td width="30%" align="right" valign="top"><a href="##GotoMyControlName" onClick="switchView('MyControlName'); return false;">My Heading Text:</a></td> <td width="1%"> </td> <td> <!-- BEGIN section of page that will toggle between show/hide by clicking link in cell above. --> <div id="MyControlName" style="display:none"> <table border="0" cellpadding="3" cellspacing="0" > <tr > <td><span class="cPreReq">MyOUTPUTgoesHere</span> </td> </tr> </table> </div> <!-- END section of page that will toggle between show/hide --> </td> </tr> </table>
URL: http://www.codekeep.net/JavaScript/code/snippets/20287/Show-Hide-table-data/view.aspx
Comments
