Click to See Complete Forum and Search --> : frame resizing


zubair
08-05-2003, 07:23 AM
Hi I have a framset with a top frame and below it two frames. a left and right one. I've pasted framset code below. what i want is a script on both my bottom left and botom right frame that when clicked will minimise the opposite frame i.e. i click a link on my left frame will expand the left frame and minimise the right frame. Also clcik it again to bring both frames to originla size. Also need a link on the right frame vice versa. Has anyone done something like this? Thanks

<frameset rows="7%,*" FRAMESPACING=0 FRAMEBORDER=3 BORDER=0 bordercolor="000000">
<frame name="#fusebox.thiscircuit#key" src="#self#?fuseaction=#XFA_DisplayKey#" marginwidth="10" marginheight="10" scrolling="No" frameborder="0">
<frameset cols="50%,*">
<frame name="#fusebox.thiscircuit#Left" id="#fusebox.thiscircuit#Left" src="index.cfm?fuseaction=#XFA_DisplayWait#&catno=#urlencodedformat(attributes.catno)#&studio=#urlencodedformat(attributes.studio)#&title=#urlencodedformat(attributes.title)#&country=#urlencodedformat(attributes.country)#&startrow=#trim(attributes.startrow)#" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
<frame name="#fusebox.thiscircuit#Right" id="#fusebox.thiscircuit#Right" src="index.cfm?fuseaction=#XFA_RequestedItems#&catno=#urlencodedformat(attributes.catno)#&studio=#urlencodedformat(attributes.studio)#&title=#urlencodedformat(attributes.title)#&country=#urlencodedformat(attributes.country)#&startrow=#trim(attributes.startrow)#" marginwidth="10" marginheight="10" scrolling="auto" frameborder="0">
</frameset>
</frameset>

Khalid Ali
08-05-2003, 09:50 AM
Add the following javascript code in the head section of your frameset page before the fraset code.

function resizeFrame(obj){
prntObj = document.getElementById("fs");
if(obj.name=="Left"){
if(prntObj.cols=="50%,*"){
prntObj.setAttribute("cols","100%,0%");
}else{
prntObj.setAttribute("cols","50%,*");
}
}else if(obj.name=="Right"){
if(prntObj.cols=="50%,*"){
prntObj.setAttribute("cols","0%,100%");
}else{
prntObj.setAttribute("cols","50%,*");
}
}
}

<frameset......

</framset>


then add the following in the page that will go in the left frame

<a href="#" onclick="parent.resizeFrame(parent.frames[1]);return false;">Resize</a>

and following in the page that will go in the right frame

<a href="#" onclick="parent.resizeFrame(parent.frames[2]);return false;">Right</a>


Note:
I am presuiming that yo have frameset with three frames..
top
------------
left | right

if thats the case the code will do exactly what you wanted.

zubair
08-05-2003, 10:30 AM
Hi, thanks for the code sample. I tried it but it would not work.
I get an object required error message

I've attached a zip file that holds my framset code.

Any more help greatly appreciated

Khalid Ali
08-05-2003, 11:06 AM
you did not implement it correctly.
I hae uploaded the solution for ou now.

zubair
08-05-2003, 11:20 AM
thanks for that! works a treat

Khalid Ali
08-05-2003, 11:22 AM
:D
you are welcome