Organizing Frameset

Posted on 2005-05-06
Medium Priority
Last Modified: 2013-11-19

     I have a frameset page with the following structure

<frameset rows="115,*,95" frameborder="YES" border="0" framespacing="0">
  <frame src="header.aspx" name="topFrame" frameborder="yes" scrolling="NO" >
      <frameset rows="*" cols="176,*,176" framespacing="0" frameborder="YES" border="0">
            <frame src="treeview.aspx" name="leftFrame" frameborder="yes" scrolling="NO" >            
            <frame src="compactview.aspx" name="mainFrame" frameborder="yes">
            <frame src="detailview.aspx" name="rightFrame" scrolling="NO" frameborder="yes" >      
  <frame src="footer.aspx" name="bottomFrame" frameborder="yes" scrolling="NO">

      and I have the following code for resize
 var columntype=""
var defaultsetting=""

function getCurrentSetting(){
if (document.body)
return (document.body.cols)? document.body.cols : document.body.rows

function setframevalue(coltype, settingvalue){
if (coltype=="rows")
else if (coltype=="cols")

function resizeFrame(contractsetting){
if (getCurrentSetting()!=defaultsetting)
setframevalue(columntype, defaultsetting)
setframevalue(columntype, contractsetting)

function init(){
if (!document.all && !document.getElementById) return
if (document.body!=null){
columntype=(document.body.cols)? "cols" : "rows"
defaultsetting=(document.body.cols)? document.body.cols : document.body.rows


 What I want to be able to do is collapse the left and right frames... but when I use the following function call and with different values

<a href="javascript:parent.resizeFrame('*,3*,5')">Contact/Expand Right Frame</a>

  It instead collapses the top and bottom frame..

   I know either the frameset structure is not proper or i am providing improper values to the function...

 which one is it??

     I  dont know to program frames..please help..

Question by:payal1711
  • 2
LVL 75

Expert Comment

by:Michel Plungjan
ID: 13950133
Why this?
columntype=(document.body.cols)? "cols" : "rows"

Looks like you can only resize cols if you have cols

Accepted Solution

Sanctus earned 400 total points
ID: 13950160
This is a generic script that works if the outter frameset is composed of columns or composed of rows.

For this particular case I made some new functions based on yours that do what you asked. You can replace your script by this one, or you can just ad it and have both the bottom and the right fram collapsed.

var defaultsettingThis=""

function initThis(){
      defaultsettingThis = document.body.childNodes[1].cols;

function resizeThis( contractsetting )
      if( document.body.childNodes[1].cols == defaultsettingThis )
            document.body.childNodes[1].cols = contractsetting;
            document.body.childNodes[1].cols = defaultsettingThis;



Then you use this link:
<a href="javascript:parent.resizeThis('*,3*,5')">Contact/Expand Right Frame</a>
LVL 75

Assisted Solution

by:Michel Plungjan
Michel Plungjan earned 100 total points
ID: 13950172
Please please use

<a href="#"
onClick="parent.resizeThis('*,3*,5'); return false">Contact/Expand Right Frame</a>

to stop unloading the page

Author Comment

ID: 13961697

 Thank you all for your excellent answers..

 Moderator, Please close the question.

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
Suggested Courses

809 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