On 5/9/05, john <[EMAIL PROTECTED]> wrote:
>create a link that says "hide content" and it will remove a section
of text from the
> page.  The layout uses some tables (XHTML Transitional), so it would
> have to hide three <tr>'s and shift the content below it up.
> 
> Can somebody please instruct me on a standards-based way of doing this?

Quick version, will hide all tr's with a class of 'hide'. Class
attribute may be a space seperated list also, as this script allows
for that.


<a href="" onclick="hideStuff">hide content</a>

<script type="text/javascript">
function hideStuff() {
    tr = document.getElementsByTagName('tr');
    for(i=0; i<tr.length; i++ ) {
        if( tr[i].className.indexOf('hide')) {
             tr[i].display = 'none';
        }
    }
}
</script>


hth,
Andrew.
--------------------------------
http://leftjustified.net/
******************************************************
The discussion list for  http://webstandardsgroup.org/

 See http://webstandardsgroup.org/mail/guidelines.cfm
 for some hints on posting to the list & getting help
******************************************************

Reply via email to