Return to Snippet

Revision: 53080
at November 12, 2011 17:06 by richtt


Initial Code
<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%">&nbsp;</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>&nbsp;</td>
                    </tr>
                    </table>
                </div>
<!-- END section of page that will toggle between show/hide -->
            </td>
          </tr>

</table>

Initial URL
http://www.codekeep.net/JavaScript/code/snippets/20287/Show-Hide-table-data/view.aspx

Initial Description
Show Hide table data uses href, anchors, div tags, and javascript to toggle between showing and hiding a table on the html page.

Initial Title
Show Hide table data

Initial Tags
javascript, html

Initial Language
JavaScript