JavaScript: set element width

    <script type="text/javascript">
    window.onload = resize;
    window.onresize = resize;

    function resize() {
    /* - FireFox does not support object reference, must use getElementby */
    var object_a= document.getElementById('a');
    var object_b = document.getElementById('b');

    /* - hidden the element DIV comments, otherwise the page will resize forever even the uesers would not notice */ = 'hidden';
/* - reduce the size first, otherwise the object_b would not resize correctly because they are under the same table */ = '0px';

    ..... other resize statements ...... = (object_b.offsetWidth - 10) + 'px'; = 'visible';

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s