G
Gunnar
Hello, I am running into problems with a simple function which should
change the style.display properties from 'block' to 'none'. I am able
to change them from 'none' to 'block' as expected.
Any suggestions are appreciated.
The Javascript:
function toggleTable(id){
var allTables = document.getElementsByTagName('table');
for(var iCount=1; iCount < allTables.length + 1; iCount++){
document.getElementById(id).style.display = "none"; // turn all
tables off
}
document.getElementById(id).style.display = "block"; //then simply turn
on the passed table id
}
The body:
<a onclick="toggleTable('table_1')">Press me</a>
<table border="1" cellpadding="0" cellspacing="0"
style="border-collapse: collapse; display: none" bordercolor="#111111"
width="100%" id="table_1">
<tr>
<td width="50%">Test</td>
<td width="50%">Test</td>
</tr>
</table>
change the style.display properties from 'block' to 'none'. I am able
to change them from 'none' to 'block' as expected.
Any suggestions are appreciated.
The Javascript:
function toggleTable(id){
var allTables = document.getElementsByTagName('table');
for(var iCount=1; iCount < allTables.length + 1; iCount++){
document.getElementById(id).style.display = "none"; // turn all
tables off
}
document.getElementById(id).style.display = "block"; //then simply turn
on the passed table id
}
The body:
<a onclick="toggleTable('table_1')">Press me</a>
<table border="1" cellpadding="0" cellspacing="0"
style="border-collapse: collapse; display: none" bordercolor="#111111"
width="100%" id="table_1">
<tr>
<td width="50%">Test</td>
<td width="50%">Test</td>
</tr>
</table>