Web Analytics Made Easy -
StatCounter How to autoresize the DIV - CodingForum

Announcement

Collapse
No announcement yet.

How to autoresize the DIV

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

    Comment


    • #3
      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>
      ------------------------------------------------------------------------

      Comment

      Working...
      X