[Javascript] Content Height

Guillaume javascript at webdesignofficina.com
Tue Oct 31 03:47:24 CST 2006


I would use /offsetHeight /to know the height of the div and then 
substract paddings, margins and borders of the div...
This way you would have the size of your content...
Something like...

var opts1 = document.getElementById("options");

  opts1H = opts1.offsetHeight;

  opts2H = opts1 - 10; // 5px top and bottom margin value for example.

  opts3H = opts2H - 10; // 5px top and bottom padding value for example.

  opts4H = opts3H - 2; // 1px top and bottom margin value for example 

  opts5H = opts4H + "px";


Details about offsetheight property can be readed here: 
http://developer.mozilla.org/en/docs/DOM:element.offsetHeight

Hope this helps...

Guillaume.

> What function I use to know the height of the content of a div, even 
> if the div has a cursor
>
> Thanks
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>  
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20061031/77c05778/attachment.htm>


More information about the Javascript mailing list