-
dynamic table size
I have two totally unrelated tables that needs to automatically adjust depending on the size of the other...
I tried using document.getElementById('mirroringTable').style.height = document.getElementById('originalTable').offsetHeight
among other things.. is there a better way to do this?
when I put
alert(document.getElementById('originalTable').offsetHeight) it outputs the right height but the problem is
document.getElementById('mirroringTable').style.height
doesn't seem to be getting the values from the equation...
can I just do this in css? a dynamic css code? instead of editing it in <script language="javascript"> ??
Thanks
-
-
When setting dimensions using style, units usually must be specified. The offset dimension is (as you may of noticed) a pure number, so this generally works:
document.getElementById('mirroringTable').style.height = document.getElementById('originalTable').offsetHeight+'px';
However, borders, margins, padding and whatever else you may have might, in some cases, need to be detected and added into the calculation. Usually not though, the offset dimension usually includes those things or they are so small that it makes virtually no difference.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks