<TBODY> is handy
TBODY? I never used it before. I thought it was just something Dreamweaver put in HTML for some reason.
But the other day, TBODY came in handy. I used it to make a quick and dirty blowout user interface like this:
| [+] Thing 1 |
| Sub Thing 1 |
| Sub Thing 2 |
The code is very simple - and I got to finally use TBODY:
<table>
<tr>
<Td>
<A href="javascript:toggle('thing1')">[+]</A>
Thing 1
</td>
</tr>
<tbody style="display:none;" id="thing1">
<tr><td>Sub Thing 1</td></tr>
<tr><td>Sub Thing 2</td></tr>
</tbody>
</table>
<tr>
<Td>
<A href="javascript:toggle('thing1')">[+]</A>
Thing 1
</td>
</tr>
<tbody style="display:none;" id="thing1">
<tr><td>Sub Thing 1</td></tr>
<tr><td>Sub Thing 2</td></tr>
</tbody>
</table>
The Javascript is nothing special:
function toggle(theID) {
foo = document.getElementById(theID);
if (foo.style.display == 'none') foo.style.display = '';
else foo.style.display = 'none';
return;
}
foo = document.getElementById(theID);
if (foo.style.display == 'none') foo.style.display = '';
else foo.style.display = 'none';
return;
}
Note I'm setting display to ''...required to work in Firefox, which all of your stuff should!
So there you go...TBODY is useful.



There are no comments for this entry.
[Add Comment]