Solved

Set height of Div element (for all browsers)

Posted on 2008-06-09
3
3,292 Views
Last Modified: 2010-04-21
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?

Thanks,

dds


function resizeContent()
{
    var NS = document.all;
    try
    {
        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;
    }
    catch(err){alert(err);}
}

Open in new window

0
Comment
Question by:dds110
  • 2
3 Comments
 
LVL 8

Author Comment

by:dds110
ID: 21744379
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
0
 
LVL 3

Accepted Solution

by:
ankitkumar29 earned 125 total points
ID: 21745561
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

0
 
LVL 8

Author Closing Comment

by:dds110
ID: 31465448
Dang, it's always the simple things that get me.  Thanks for the assist.  I appreciate it.
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

#Citrix #Internet Explorer #Enterprise Mode #IE 11 #IE 8
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question