Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question How to autoresize the DIV

    Hello all!
    I hava 3 DIV's in one page, and the height of first and second was fixed.
    I want to that the third DIV 's height was autoresized when the browser's size was changed. For example adjustment by the user.

    Details:
    1.The height of the first and second was fixed.
    2.The height of the third was fixed too but resizeable by the JavaScript
    3.Three of the DIV's Width was fixed by the 100%.

    expectancy:
    When the size of the browser was changed by the user,the height of the third DIV was autoresized to fit the browser.

    Thanks!
    guryu
    20061016

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    make it clear the CSS (or whchever) relationship betweens all your DIVs. Can we see a shortened variant of your code? (the position of your DIVs and the relationship between them)
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    New to the CF scene
    Join Date
    Oct 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow

    Quote Originally Posted by Kor View Post
    make it clear the CSS (or whchever) relationship betweens all your DIVs. Can we see a shortened variant of your code? (the position of your DIVs and the relationship between them)

    My code is as below,but I wan to make it all by JavaScript.
    ------------------------------------------------------------------
    <script type="text/javascript">
    <!--
    function modeTest()
    {
    return (document.compatMode && document.compatMode!="BackCompat")?
    document.documentElement:document.body;
    }

    onresize = function()
    {
    var Elementy = document.documentElement.scrollHeight? document.documentElement.scrollHeight:modeTest().scrollHeight;
    var td1 = document.getElementById("td1").clientHeight;
    var td2 = document.getElementById("td2").clientHeight;
    var td3 = document.getElementById("td3").clientHeight;
    var td4 = document.getElementById("td4").clientHeight;
    var div1 = 150;
    var div2 = 150;

    document.getElementById("div3").style.height = Elementy -(td1+td2+td3+td4+div1+div2)+"px";

    window.onresize = modeTest();

    }

    //-->
    </script>
    ------------------------------------------------------------------------


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •