Solved

Set height of Div element (for all browsers)

Posted on 2008-06-09
3
3,291 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

786 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