473,411 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

DOM minHeight and Height - IE Hack?

1
Hello all,

I am trying to make a div on my website dynamically resize to to fill up any empty space left over on the users screen.

The code I am using now that works perfectly for Firefox is

Expand|Select|Wrap|Line Numbers
  1. function initialize(){
  2.     frame = document.getElementById('frame');
  3.     headerHeight = document.getElementById('top').offsetHeight
  4.     headerMargin = 10;
  5.     footerHeight = document.getElementById('footer').offsetHeight
  6.     footerMargin = 16;
  7.     frameBorder = 2;
  8.     height = headerHeight + headerMargin + footerHeight + footerMargin + frameBorder;
  9.     frame.style.minHeight = document.height - height;
  10. }
I know IE does not recognize minHeight property but I have tried other ways to accomplish my goal but no luck. Here is an example of what is going on. View this page in IE and Firefox and see the difference.

http://wow.guildprogress.com/user/quickAddGuild.php

Thanks for any replies!
Apr 2 '08 #1
1 1568
First, since your site is in the buggy quirks mode, I would add this to the top of every page in your site:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2.  
Then I would change this line:

Expand|Select|Wrap|Line Numbers
  1. frame.style.minHeight = document.height - height;
  2.  
to this and test it out:

Expand|Select|Wrap|Line Numbers
  1. frame.style.height = (document.body.clientHeight - height) + "px";
  2.  
Also my guess is that the function you wrote, initialize() is only executed when the page loads. If that's the case and someone resizes their screen, then you'll probably want to run that function again. Assuming you don't have any onresize events on your page, add this line of code outside of the function initialize() and just below it:

Expand|Select|Wrap|Line Numbers
  1. window.onresize = initialize;
  2.  
Matt

Hello all,

I am trying to make a div on my website dynamically resize to to fill up any empty space left over on the users screen.

The code I am using now that works perfectly for Firefox is

Expand|Select|Wrap|Line Numbers
  1. function initialize(){
  2.     frame = document.getElementById('frame');
  3.     headerHeight = document.getElementById('top').offsetHeight
  4.     headerMargin = 10;
  5.     footerHeight = document.getElementById('footer').offsetHeight
  6.     footerMargin = 16;
  7.     frameBorder = 2;
  8.     height = headerHeight + headerMargin + footerHeight + footerMargin + frameBorder;
  9.     frame.style.minHeight = document.height - height;
  10. }
I know IE does not recognize minHeight property but I have tried other ways to accomplish my goal but no luck. Here is an example of what is going on. View this page in IE and Firefox and see the difference.

http://wow.guildprogress.com/user/quickAddGuild.php

Thanks for any replies!
Apr 2 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Neil Zanella | last post by:
Hello, Consider the height property in the code shown below... I am dissatisfied with the height propery. When I set it to 100% the table does not fill the entire vertical space available to...
6
by: Robert Lapes | last post by:
I'm just getting into using CSS and I'm having a problem getting Opera to display a Navigation Bar in the same way as IE6. Can someone please point me in the right direction? The site I'm...
11
by: Chris Beall | last post by:
Here's the problem: http://pages.prodigy.net/chris_beall/Demo/theproblem.html The page contains inline text, then some additional pairs of text which are floated right and left. (This is a...
1
by: avocado12 | last post by:
Hi, I'm pretty new to web development and I just spent the better part of the morning trying to figure out this IE bug. I came up with a hack that makes no sense to me. I would appreciate if...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.