Forum Moderators: open
I have 3 tables next to each other and would like to dynamically alter the height of a cell in the last 2 tables according to the height of a cell in the first table (the cell in the first table does not have a static height, but can change in height depending on what text is placed in it)
Css
<style type="text/css">
#table1{
background-color:red;
display:inline;
}
#table2{
background-color:blue;
display:inline;
}
#table3{
background-color:green;
display:inline;
}
</style>
html
<table id="table1">
<tr>
<td id="cell1"> <br> <br> <br> <br></td>
</tr>
</table><table id="table2">
<tr>
<td id="cell2"> </td>
</tr>
</table><table id="table3">
<tr>
<td id="cell3"> </td>
</tr>
</table>
Javascript (must be placed after the tables have loaded)
<script type="text/javascript">
cellOne = (document.getElementById('cell1').offsetHeight);
cellTwo = (document.getElementById('cell2').offsetHeight);
cellThr = (document.getElementById('cell3').offsetHeight);if(cellOne > cellTwo && cellOne > cellThr){ newHeight = cellOne; }
if(cellTwo > cellOne && cellTwo > cellThr){ newHeight = cellTwo; }
if(cellThr > cellOne && cellThr > cellTwo){ newHeight = cellThr; }document.getElementById('cell1').style.height = newHeight + 'px';
document.getElementById('cell2').style.height = newHeight + 'px';
document.getElementById('cell3').style.height = newHeight + 'px';
</script>
As Trace has pointed out this only happens locally.
To effect a cure for the page add this snippet of code directly after the DOCTYPE...
[color=navy]
[blue][2]<!-- saved from url=(0014)about:internet --> [/2][/blue]
[/color] [msdn.microsoft.com ]
[edited by: birdbrain at 8:53 pm (utc) on Oct. 29, 2007]
No problem, you're welcome. ;)