www.webdeveloper.com
Results 1 to 3 of 3

Thread: Make invisible some rows in a table

  1. #1
    Join Date
    Nov 2005
    Posts
    9

    Make invisible some rows in a table

    Hi friends
    I have a table it has some rows. and i have a button in first row first column.

    so that if i press the button i want 2,3 rows become invisible,
    and again if i press the button those rows sholud become visible by using client side scripting.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en">
    <head>
    <title>table rows</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    <script type="text/javascript">
    function toggle(obj) {
    var aTR=obj.parentNode.parentNode.parentNode.getElementsByTagName('tr');
    var show=(document.all)? 'block' : 'table-row';
    for(var i=1; i<3; i++) {
        aTR[i].style.display=(aTR[i].style.display=='none')? show : 'none';
        }
    }
    </script>
    
    </head>
    <body>
    <table border="1" cellpadding="0" cellspacing="0" summary="">
    <tbody>
    <tr><td><button type="button" onclick="toggle(this);">toggle rows</button></td><td>1</td></tr>
    <tr><td></td><td>2</td></tr>
    <tr><td></td><td>3</td></tr>
    <tr><td></td><td>4</td></tr>
    <tr><td></td><td>5</td></tr>
    </tbody>
    </table>
    </body>
    </html>
    At least 98% of internet users' DNA is identical to that of chimpanzees

  3. #3
    Join Date
    Nov 2005
    Posts
    9
    Thanks fang
    it is working fine

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles