Thanks, Martin, Carl and Grant.
I probably should read those document in details before trying stunts. :)
The problem lies in the table (someone else's work) I'm working on is that
there is a long rowspan. By using TBODY, it will interrupt the display of
the form.
Carl's suggestion works well, I put the same style to the rows needed to be
hidden and use javascript to toggle the stylesheet's rule.
________________________________________
<HTML>
<style type="text/css">
<!--
..block {
display: block;
}
-->
</style>
<script language="JavaScript">
function toggle(){
var theTable = (document.getElementById('myTABLE'));
var theTB = theTable.tBodies.item(0);
var theTR = document.styleSheets[0].rules[0];
if ((theTR.style.display=="")||(theTR.style.display== "block"))
theTR.style.display="none";
else
theTR.style.display="block";
}
</script>
<BODY>
<table id="myTABLE" border="1" width="100" align="center" cellpadding="0"
cellspacing="0">
<tr id="TR1" class="block1">
<td width="50" id="TD11">1.1</td>
<td width="50" id="TD12">1.2</td>
</tr>
<div id="text">
<tr id="TR2" class="block">
<td width="50" id="TD21">2.1</td>
<td width="50" id="TD22">2.2</td>
</tr>
<tr id="TR3" class="block">
<td width="50" id="TD31">3.1</td>
<td width="50" id="TD32">3.2</td>
</tr>
</div>
</table>
<br><br>
<center><a href="javascript
:toggle();">show/hide</a></center>
</BODY>
</HTML>
__________________________________________
"Martin Honnen" <mahotrash@yahoo.de> wrote in message
news:4107bd2b$1@olaf.komtel.net...[color=blue]
>
>
> Wang, Jay wrote:
>[color=green]
> > I try to group several rows in a table into a div and show/hide them by
> > click on a button somewhere with a javascript link. When clicked, the[/color][/color]
link[color=blue][color=green]
> > will toggle the style of the div section's style between BLOCK and NONE.
> >
> > This technique works on normal text fine, but it doesn't work on part of[/color][/color]
the[color=blue][color=green]
> > table, is there a solution that I can achieve the goal of turning on/off
> > several rows all together? Thanks.[/color]
>
> With HTML 4 you can certainly put <tr> elements into a <tbody> element
> to group them and then hide the complete <tbody> element with script
> changing the CSS display property. A <div> element however is not meant
> to group <tr> elements.
>
> --
>
> Martin Honnen
>
http://JavaScript.FAQTs.com/
>[/color]