Loading ...
Sorry, an error occurred while loading the content.

Re: Find available remaining height

Expand Messages
  • j_al_anderson
    Nige, the hight of an object can be pulled out with javascript but as usual there are three formulas to get the height. This is the formula that I like to use;
    Message 1 of 3 , Mar 6, 2006
    • 0 Attachment
      Nige, the hight of an object can be pulled out with javascript but as
      usual there are three formulas to get the height. This is the formula
      that I like to use;

      /* first detect ie, ns4, and w3c browser type */

      var ie = document.all ? 1 : 0
      var ns4 = document.layers ? 1 : 0
      var w3c = document.getElementById ? 1 : 0

      /* then run this function feeding the id of the target object */

      function getHeight(id) {
      obj=dom(id);
      height = ie ? obj.offsetHeight : ns4 ? obj.clip.height :
      document.defaultView.getComputedStyle(obj, "").getPropertyValue
      ("height").substring(0,document.defaultView.getComputedStyle
      (obj, "").getPropertyValue("height").indexOf("p"))
      return height;
      }

      /* it should return the number */

      I have only tested this on one project and it was internal so I don't
      know what the other browsers will return but it has worked for me
      before.


      --- In ydn-javascript@yahoogroups.com, Nige White <nigelw@...> wrote:
      >
      > I'm adjusting the height of a container div to contain a table (I'm
      > creating a table with a scrollable body, and fixed header). The
      > container div must be just exactly the height remaining inside ITS
      > container so that its style can be set to "overflow:auto":
      >
      > +-----------------------+
      > | Descrip - dragbar |
      > +-----------------------+
      > | col | col | col | col |
      > +-----------------------+
      > | ^ |
      > | | |
      > | How high? |
      > | | |
      > | v |
      > +-----------------------+
      >
      > IMHO, "height:100%", should mean "100% of the REMAING AVAILABLE
      height",
      > but since it doesn't in fact work like that, has anyone solved this
      problem?
      >
      > Nige
      >
      >
      _____________________________________________________________________
      > This message has been checked for all known viruses. Virus scanning
      > powered by Messagelabs http://www.messagelabs.com For more
      information
      > e-mail : hostmaster@...
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.