Solved

Get floating frame to fill remaining space

Posted on 2002-04-24
4
452 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

832 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