Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3300
  • Last Modified:

Set height of Div element (for all browsers)

Hi all,

Please see the attached code snippet.  I'm trying to resize a div element to take up all available screen space to minimize scroll bars.  This works fine in IE but  not in NN or FF.  Can anyone push me in the right direction?



function resizeContent()
    var NS = document.all;
        document.getElementById("divContent").style.height=(!NS)?window.innerHeight - 85:document.body.clientHeight - 85;
        //document.getElementById("tdContent").style.height=(!NS)?window.innerHeight - 101:document.body.clientHeight - 101;

Open in new window

  • 2
1 Solution
dds110Author Commented:
Oh yeah, I should have mentioned the error I'm getting; here it is:

Warning: Error in parsing value for property 'height'.  Declaration dropped.
Source File: http://localHost/mysite
Line: 0
height etc in ff cant be just number. it has to end with pt or px. So you cant do height=5 but height =5pt .

Try this line instead for ff

document.getElementById("divContent").style.height=(!NS)?(window.innerHeight - 85)+"pt":(document.body.clientHeight - 85)+"pt";

Open in new window

dds110Author Commented:
Dang, it's always the simple things that get me.  Thanks for the assist.  I appreciate it.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now