Solved

Get floating frame to fill remaining space

Posted on 2002-04-24
4
449 Views
Last Modified: 2006-11-17
Hi,

I have 3 floating frames on a webpage that split the page into 3 horizontal areas. The first 2 frames are fixed heights but I would like the last frame to fill the remaining height in the window. Does anyone know how to do this?

<IFRAME SRC="TopFrame.html" WIDTH=100% HEIGHT=250 MARGINWIDTH=0 >
<IFRAME NAME="TableHeading" WIDTH=100% HEIGHT=100 noresize>
<IFRAME NAME="MainWindow" WIDTH=100% >

I know that using non-floating frames you can do this in the surrounding FRAMESET (250,100,*) but this doesn’t work for floating frames.

The reason I can’t do this with non-floating frames is that my frame page is called with FORM data and it has some dynamic elements to submit this data to one of the frames.
0
Comment
Question by:AndyReed
  • 2
4 Comments
 
LVL 33

Accepted Solution

by:
knightEknight earned 150 total points
ID: 6965735
<HTML>
<HEAD>
<SCRIPT language='javascript'>

function getX(obj)
{
  return( obj.offsetParent==null ? obj.offsetLeft : obj.offsetLeft+getX(obj.offsetParent) );
}

function getY(obj)
{
  return( obj.offsetParent==null ? obj.offsetTop : obj.offsetTop+getY(obj.offsetParent) );
}

function resize()
{

   var h = document.body.clientHeight
         - (document.all.TopFrame.height*1)
         - (document.all.TableHeading.height*1)
         - getY(document.all.TopFrame)
         - 5;

   document.all.MainWindow.height = h;

}

</script>
</head>
<BODY onLoad='resize();' onresize='resize();'>

<IFRAME NAME="TopFrame"     id="TopFrame"      WIDTH=100%  HEIGHT='200'  SRC="adressen.txt"  MARGINWIDTH=0 />
<IFRAME NAME="TableHeading" id="TableHeading"  WIDTH=100%  HEIGHT='100'  noresize />
<IFRAME NAME="MainWindow"   id="MainWindow"    WIDTH=100% />

</body>
</html>
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 6965738
oops, src for the top frame should be:  SRC="TopFrame.html"
0
 
LVL 4

Expert Comment

by:EricWestbo
ID: 6965770
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">

    if (navigator.appName == 'Netscape' && document.layers != null) {
        wid = window.innerWidth;
        hit = window.innerHeight;
    }

    if (document.all != null){
        wid = document.body.clientWidth;
        hit = document.body.clientHeight;
    }

    var fil = hit - 350;
    document.write('<IFRAME SRC="TopFrame.html" WIDTH=100% HEIGHT=250 MARGINWIDTH=0>');
    document.write('<IFRAME NAME="TableHeading" WIDTH=100% HEIGHT=100 noresize>');
    document.write('<IFRAME NAME="MainWindow" WIDTH=100% HEIGHT=' + fil +'>');

</script>
0
 

Author Comment

by:AndyReed
ID: 6965919
Perfect, thanks knightEknight.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

759 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

20 Experts available now in Live!

Get 1:1 Help Now