Organizing Frameset

Posted on 2005-05-06
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
    LVL 75

    Expert Comment

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

    Looks like you can only resize cols if you have cols
    LVL 3

    Accepted Solution

    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
    Please please use

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

    to stop unloading the page
    LVL 1

    Author Comment


     Thank you all for your excellent answers..

     Moderator, Please close the question.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

    737 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

    17 Experts available now in Live!

    Get 1:1 Help Now