Solved

Set height of Div element (for all browsers)

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Several part series to implement Internet Explorer 11 Enterprise Mode
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

912 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

24 Experts available now in Live!

Get 1:1 Help Now