Solved

Set height of Div element (for all browsers)

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

708 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now