Resizing Frames

When the user first enters the page I need the rows to be set to 0%. Once the user clicks on page "Task Page Browse", I need to change the default row size of the frame to 15%. If the user resizes the frame, exit and reloads Task Page Browse page, I need the frame row size to stay the new size that the user changed to.
My problem is that if I set row to 15%, then my code to resize frame does not work. But if I comment out the line that sets row to 15%, then my code for resizing the frame works but the initial row size is not 15%.
Would appreciate any help. Thanks.

//This code is in Frames.htm
<HTML>
<FRAMESET id="TaskFrame" rows="0%,*">
<FRAME SRC="StartHere.htm" NAME="TaskTitleFrame" scrolling="auto">
<FRAME SRC="StartHere.htm" NAME="TaskPageFrame" scrolling="auto">
</FRAMESET>
</HTML>

//Here is my code in Task Page Browse.jsp to set initial row to 15% and code to reset row to resized frame size

<script>
function resizeFrame(){
var w = (document.body.clientWidth)?document.body.clientWidth:(window.innerWidth)?window.innerWidth:0;
if (!w) return;
document.getElementById('TaskFrame').setAttribute("rows",w+",*");
}
</script>

window.parent.document.all.TaskFrame.rows = '15%,*';//if this line is not commented out then the following two lines do not function and row size is always 15.
//if the above line is commented out then the below code works.
window.parent.document.all.TaskTitleFrame.onresize = 'resizeFrame()';
window.parent.document.all.TaskTitleFrame.onload='resizeFrame';
[1740 byte] By [azi_1] at [2007-11-19 12:02:03]
# 1 Re: Resizing Frames
Here is a complete example for resizing frames. I hope it is addressing your issue, or at least, it will help you.

The frameset:

<HTML>
<FRAMESET id="TaskFrame" rows="0%,*">
<FRAME SRC="StartHere.htm" NAME="TaskTitleFrame" scrolling="auto">
<FRAME SRC="StartHere.htm" NAME="TaskPageFrame" scrolling="auto">
</FRAMESET>
</HTML>

The frame (file StartHere.htm)

<html><head>
<script language=javascript>
function resizeFrame()
{
if (document.getElementById('w').value == 15)
window.parent.document.all.TaskFrame.rows = '15%,*';
else
if (document.getElementById('w').value == 0)
window.parent.document.all.TaskFrame.rows = '0%,*';
return;
}
function change_header_size()
{
if (document.getElementById('bt_show_hide_header').value == "Show header") {
document.getElementById('w').value = 15;
document.getElementById('bt_show_hide_header').value = "Hide header";
}
else {
document.getElementById('w').value = 0;
document.getElementById('bt_show_hide_header').value = "Show header";
}
resizeFrame();
return;
}
</script>
</head><body>
<h2>Hi</h2>
<form>
<input type=hidden id="w" value=0>
<input type=button id="bt_show_hide_header" onclick="change_header_size();" value="Show header">
</form>
<script language=javascript>
window.parent.document.all.TaskTitleFrame.onload='resizeFrame()';
</script>
</body></html>

I have placed a button (this could be a link) in the frame saying either "Show header", either "Hide header". There is a hidden variable saying that the size is 0 (when it starts), or 15 (when the user want to split the window).
The user can resize the frames, no problemo.
olivthill at 2007-11-8 0:21:29 >
# 2 Re: Resizing Frames
Thanks for your sample code!
Using this code, everytime the user changes frame size in TaskPageBrowse, when the page reloads it remembers that frame size. However, I want when the page loads initialy to start with frame size of 15, but it still loads with a frame size of 0. It doesn't seem to change from row size of 0 to 15. Please let me know if you can see why this is happening.
Thanks.

In TaskPageBrowse.jsp
<script>
function resize()
{
if (document.getElementById('w').value == 15)
window.parent.document.all.TaskFrame.rows = '15%,*';
else
if (document.getElementById('w').value == 0)
window.parent.document.all.TaskFrame.rows = '0%,*';
return;
}
</script>
<script>
//Frame row needs to change from 0 to 15 everytime this file loads
window.parent.document.all.TaskFrame.rows = '15%,*';
//To auto change frame size when user changes frame size
window.parent.document.all.TaskFrame.onload='resize()';
</script>

//Frame.html--Frame row needs to start at 0
<HTML>
<FRAMESET id="TaskFrame" rows="0%,*">
<FRAME SRC="StartHere.htm" NAME="TaskTitleFrame" scrolling="auto">
<FRAME SRC="StartHere.htm" NAME="TaskPageFrame" scrolling="auto">
</FRAMESET>
</HTML>
azi_1 at 2007-11-8 0:22:22 >
# 3 Re: Resizing Frames
Excuse-me, I thought you wanted to start with 0%.

In order to start with 15%, just set the hidden variable, w, to 15.

<form>
<input type=hidden id="w" value=15>
</form>
olivthill at 2007-11-8 0:23:23 >
# 4 Re: Resizing Frames
Thanks for your reply.
I have set value to 15, and I'm using exactly the above code. When the user resizes the frame, frame size automatically changes, however, when TaskPageBrowse loads the frame size is still 0 and not 15. I am not sure why it's ignoring this line?
window.parent.document.all.TaskFrame.rows = '15%,*';
Thanks.

//TaskPageBrowse.jsp
<html><head>
<script language=javascript>
function resizeFrame()
{
if (document.getElementById('w').value == 15)
window.parent.document.all.TaskFrame.rows = '15%,*';
else
if (document.getElementById('w').value == 0)
window.parent.document.all.TaskFrame.rows = '0%,*';
return;
}
<body>
<form>
<input type=hidden id="w" value=15>
</form>
<script language=javascript>
window.parent.document.all.TaskTitleFrame.onload='resizeFrame()';
</script>
</body>

//Frame.html
<HTML>
<FRAMESET id="TaskFrame" rows="0%,*">
<FRAME SRC="StartHere.htm" NAME="TaskTitleFrame" scrolling="auto">
<FRAME SRC="StartHere.htm" NAME="TaskPageFrame" scrolling="auto">
</FRAMESET>
</HTML>
azi_1 at 2007-11-8 0:24:28 >
# 5 Re: Resizing Frames
Hi,

When I execute this script, I get "Access is denied" error message, and nothing happens.

Does anyone know why would this happen?

Thanks!
Roman
radubov at 2007-11-8 0:25:28 >
# 6 Re: Resizing Frames
Unless you are experiencing server rights, it doesn't seem to make sense.
PeejAvery at 2007-11-8 0:26:33 >