Hide table/row

Discussion in 'HTML' started by John M, Oct 16, 2003.

  1. John M

    John M Guest

    I want to hide the first row in my table and if a user click on a show
    button than show it. If it is visible than user can hide it with click a
    hide button.
    In default I hide it with:

    <tr id="ds" style="display:none">

    but how can I make it visible or hide it dynamicaly?

    Is it possible to do it not with TR but with TABLE?

    Thanks!
     
    John M, Oct 16, 2003
    #1
    1. Advertising

  2. In article <yqzjb.36599$>,
    says...
    > I want to hide the first row in my table and if a user click on a show
    > button than show it. If it is visible than user can hide it with click a
    > hide button.
    > In default I hide it with:
    >
    > <tr id="ds" style="display:none">
    >
    > but how can I make it visible or hide it dynamicaly?
    >
    > Is it possible to do it not with TR but with TABLE?


    <script type="text/javascript">
    var tableRow = document.getElementById('ds');
    tableRow.style.display = 'none';
    // tableRow.style.display = 'block';
    </script>

    --
    Hywel I do not eat quiche
    http://hyweljenkins.co.uk/
    http://hyweljenkins.co.uk/mfaq.php
     
    Hywel Jenkins, Oct 16, 2003
    #2
    1. Advertising

  3. Hywel Jenkins wrote:

    >> <tr id="ds" style="display:none">

    >
    > <script type="text/javascript">
    > var tableRow = document.getElementById('ds');
    > tableRow.style.display = 'none';
    > // tableRow.style.display = 'block';
    > </script>


    display: block? For a <tr>? Shouldn't that be display: table-row?

    (The results of display: block on table cells are ... interesting in Mozilla
    (and Opera IIRC). I expect block rows would be almost as undesired)

    --
    David Dorward http://dorward.me.uk/
     
    David Dorward, Oct 16, 2003
    #3
  4. In article <bmn7j9$jst$4$>,
    says...
    > Hywel Jenkins wrote:
    >
    > >> <tr id="ds" style="display:none">

    > >
    > > <script type="text/javascript">
    > > var tableRow = document.getElementById('ds');
    > > tableRow.style.display = 'none';
    > > // tableRow.style.display = 'block';
    > > </script>

    >
    > display: block? For a <tr>? Shouldn't that be display: table-row?


    Probably - long day, couldn't be arsed to think clearly for someone
    else.

    --
    Hywel I do not eat quiche
    http://hyweljenkins.co.uk/
    http://hyweljenkins.co.uk/mfaq.php
     
    Hywel Jenkins, Oct 17, 2003
    #4
  5. David Dorward wrote:

    > display: block? For a <tr>? Shouldn't that be display: table-row?


    I'm not sure how well Internet Explorer would handle that.

    Possibly best something like:

    <script type="text/javascript">
    function hiderow(x) {
    if ( document.all ) {
    document.getElementById(x).style.visibility="hidden";
    } else {
    document.getElementById(x).style.display="none";
    }
    }
    function showrow(x) {
    if ( document.all ) {
    document.getElementById(x).style.visibility="visible";
    } else {
    document.getElementById(x).style.display="table-row";
    }
    }
    function showcontrols() {
    document.getElementById('controls').style.display="block";
    }
    </script>
    <body onload="hiderow('ds');showcontrols();">
    <table>
    <tr id="ds"><td>Hello World</td></tr>
    </table>
    <ul style="display:none;" id="controls">
    <li onclick="hiderow('ds');">Hide</li>
    <li onclick="showrow('ds');">Show</li>
    </ul>
    </body>

    Of course, this will add confusing controls to non-CSS, non-JS browsers.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me - http://www.goddamn.co.uk/tobyink/?id=132
     
    Toby A Inkster, Oct 17, 2003
    #5
  6. John M

    fatex

    Joined:
    Jul 1, 2012
    Messages:
    1
    Please i need help concerning this code. I want to hide rows whose total is zero. Once a row have zero as value for total i want it hidden. I need this assistance asap. Thank you




    $query = "SELECT * FROM firsttermsar
    WHERE studentID=$stuID AND year=\"$_SESSION[year]\"";[​IMG] #27
    $result = mysql_query($query)
    or die ("Couldn't execute query.");
    while ($row = mysql_fetch_array($result,MYSQL_ASSOC))
    {
    echo "<h2> FIRST TERM RESULT for $namet during the SESSION $year</h2>";
    echo "<table class='table1'>";

    echo "<tr>";
    echo "<td><b>Mark Obtainable</b></td>";
    echo "<td><b>CA(30)</b>[​IMG]</td>
    <td><b>Exam</b></[​IMG]td> <td><b>Total(70)</b><[​IMG]/td><td><b>Grade</b>[​IMG]</td><td><b>Comment<[​IMG]/b></td><td><b>Teac[​IMG]her's Signature</b></td></tr>[​IMG]";
    if ($total>="1")
    echo "<td>English Language: </td>";
    echo "<td>{$row['firstengtest']}<[​IMG]/td> <td>{$row['firstengexam']}</td>[​IMG] <td>";
    $total = $row['firstengtest']+$row['firstengexam'[​IMG]];
    echo $total."</td><td>";[​IMG]

    if ($total>="70")
    echo "A ";
    elseif ($total>="60")
    echo "B";
    elseif ($total>="50")
    echo "C";
    elseif ($total>="40")
    echo "D";
    elseif ($total>="30")
    echo "E";
    elseif ($total=="0")
    echo "-";
    else
    echo "F";


    echo "</td><td> </td> <td>";
    if ($total>="70")
    echo "EXCELLENT";
    elseif ($total>="60")
    echo "VERY GOOD";
    elseif ($total>="50")
    echo "GOOD";
    elseif ($total>="40")
    echo "PASS";
    elseif ($total>="30")
    echo "POOR";
    elseif ($total=="0")
    echo "-";
    else
    echo "FAIL";
    echo "</td></tr>";

    echo "<tr>";
    echo "<td>Mathematics </td>";
    echo "<td>{$row['firstmathtest']}<[​IMG]/td> <td>{$row['firstmathexam']}</td[​IMG]> <td>";
    $total = $row['firstmathtest']+$row['firstmathexa[​IMG]m'];
    echo $total."</td><td>";[​IMG]

    if ($total>="70")
    echo "A";
    elseif ($total>="60")
    echo "B";
    elseif ($total>="50")
    echo "C";
    elseif ($total>="40")
    echo "D";
    elseif ($total>="30")
    echo "E";
    elseif ($total=="0")
    echo "-";
    else
    echo "F";



    echo "</td><td> </td> <td>";
    if ($total>="70")
    echo "EXCELLENT";
    elseif ($total>="60")
    echo "VERY GOOD";
    elseif ($total>="50")
    echo "GOOD";
    elseif ($total>="40")
    echo "PASS";
    elseif ($total>="30")
    echo "POOR";
    elseif ($total=="0")
    echo "-";
    else
    echo "FAIL";
    echo "</td></tr>";

    echo "<tr>";
    echo "<td>Physics: </td>";
    echo "<td>{$row['firstphytest']}<[​IMG]/td> <td>{$row['firstphyexam']}</td>[​IMG] <td>";
    $total = $row['firstphytest']+$row['firstphyexam'[​IMG]];
    echo $total."</td><td>";[​IMG]

    if ($total>="70")
    echo "A";
    elseif ($total>="60")
    echo "B";
    elseif ($total>="50")
    echo "C";
    elseif ($total>="40")
    echo "D";
    elseif ($total>="30")
    echo "E";
    elseif ($total=="0")
    echo "-";
    else
    echo "F";


    echo "</td><td> </td> <td>";
    if ($total>="70")
    echo "EXCELLENT";
    elseif ($total>="60")
    echo "VERY GOOD";
    elseif ($total>="50")
    echo "GOOD";
    elseif ($total>="40")
    echo "PASS";
    elseif ($total>="30")
    echo "POOR";
    elseif ($total=="0")
    echo "-";
    else
    echo "FAIL";
    echo "</td></tr>";

    echo "<tr>";
    echo "<td>Chemistry: </td>";
    echo "<td>{$row['firstchemtest']}<[​IMG]/td> <td>{$row['firstchemexam']}</td[​IMG]> <td>";
    $total = $row['firstchemtest']+$row['firstchemexa[​IMG]m'];
    echo $total."</td><td>";[​IMG]

    if ($total>="70")
    echo "A";
    elseif ($total>="60")
    echo "B";
    elseif ($total>="50")
    echo "C";
    elseif ($total>="40")
    echo "D";
    elseif ($total>="30")
    echo "E";
    elseif ($total=="0")
    echo "-";
    else
    echo "F";



    echo "</td><td> </td> <td></td></tr>";
     
    fatex, Jul 1, 2012
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RA
    Replies:
    1
    Views:
    4,051
  2. Utter Newbie

    Hide Table Row In Repeater?

    Utter Newbie, Aug 25, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    8,192
    bartekm
    Mar 3, 2011
  3. phl
    Replies:
    1
    Views:
    4,416
    Martin Jay
    Jun 8, 2006
  4. D
    Replies:
    0
    Views:
    252
  5. UJ
    Replies:
    1
    Views:
    142
Loading...

Share This Page