How to Get / Set Div and Table Width / Height

Posted by Nasser Hajloo on Stack Overflow See other posts from Stack Overflow or by Nasser Hajloo
Published on 2010-06-02T05:25:05Z Indexed on 2010/06/02 5:33 UTC
Read the original article Hit count: 144

Filed under:
|
|
|
|

I have a Table (or a region) and want to set it's Width and Height value to another Div (or region).

The second one is actually a Ajax Indicator modal which display a loading text when the page is asynchronously post back. here is the example

<table id="MainTable">
    <tr>
        <td>
             Content ....
        </td>
    </tr>
</table>

<div id="Progress">
     Ajax Indocator
</div>

the following javascript didn't work

document.getElementById("Progress").style.width = document.getElementById("MainTable").style.width;
document.getElementById("Progress").style.height = document.getElementById("MainTable").style.height;

It should work both on IE and FireFox. how to correct it.

I checked some other solution in StackOverFlow but I couldn't fix it.

I'mwaiting to hear from you.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about JavaScript