Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Hide table/row

Reply
Thread Tools

Hide table/row

 
 
John M
Guest
Posts: n/a
 
      10-16-2003
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!


 
Reply With Quote
 
 
 
 
Hywel Jenkins
Guest
Posts: n/a
 
      10-16-2003
In article <yqzjb.36599$(E-Mail Removed)>, http://www.velocityreviews.com/forums/(E-Mail Removed)
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
 
Reply With Quote
 
 
 
 
David Dorward
Guest
Posts: n/a
 
      10-16-2003
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/
 
Reply With Quote
 
Hywel Jenkins
Guest
Posts: n/a
 
      10-17-2003
In article <bmn7j9$jst$4$(E-Mail Removed)>, (E-Mail Removed)
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
 
Reply With Quote
 
Toby A Inkster
Guest
Posts: n/a
 
      10-17-2003
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="hidde n";
} else {
document.getElementById(x).style.display="none";
}
}
function showrow(x) {
if ( document.all ) {
document.getElementById(x).style.visibility="visib le";
} 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

 
Reply With Quote
 
fatex fatex is offline
Junior Member
Join Date: Jul 2012
Posts: 1
 
      07-01-2012
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]\""; #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></td>
<td><b>Exam</b></td> <td><b>Total(70)</b></td><td><b>Grade</b></td><td><b>Comment</b></td><td><b>Teacher's Signature</b></td></tr>";
if ($total>="1")
echo "<td>English Language: </td>";
echo "<td>{$row['firstengtest']}</td> <td>{$row['firstengexam']}</td> <td>";
$total = $row['firstengtest']+$row['firstengexam'];
echo $total."</td><td>";

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']}</td> <td>{$row['firstmathexam']}</td> <td>";
$total = $row['firstmathtest']+$row['firstmathexam'];
echo $total."</td><td>";

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']}</td> <td>{$row['firstphyexam']}</td> <td>";
$total = $row['firstphytest']+$row['firstphyexam'];
echo $total."</td><td>";

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']}</td> <td>{$row['firstchemexam']}</td> <td>";
$total = $row['firstchemtest']+$row['firstchemexam'];
echo $total."</td><td>";

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>";
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to selectively hide Wireless Network Connection icon =?Utf-8?B?SmFtZXM=?= Wireless Networking 1 10-27-2005 10:18 PM
GRE, hide nat on PIX Jean-Michel Dewaal Cisco 1 08-14-2005 11:50 PM
Ports to open to the firewall (Hide Nat, Cisco VPN) Alabama Circus Cisco 1 06-04-2005 12:15 PM
[HIDE LAN] Hide a part of hosts into the LAN at VPN users? Paolo Bresi Cisco 1 04-04-2005 02:41 PM
"Hide Selection" - can this be remembered? Scott McNair ASP .Net 1 06-17-2004 02:26 PM



Advertisments