Enlarge Frame in corrrect scroll position
Posted on 2003-03-28
I have a page, which is three frames: a title page, a table of contents page, and a text page. In the table of contents page I have a button that enlarges the text page to a full page.
This is the code:
<p align="center"><input type="Button" value="Full Page" name="Bt1" onClick=enlarge();></p>
This works fine, but it opens the text page at the beginning of the page. If the reader has, for instnace, scrolled down in the page, the scroll position is lost. What I want is to have the page open to scoll position it is presently at.
I know that window.document.body.scrollTop gets the scroll position, but how to fit that into the code so that it gets the scroll position of the text (called 'right') frame page, instead of the TOC page, where the code is, and how can I feed that information to the enlarge function?
I've done some work on this myself and so I have a better idea where the problem is. Here's the revised code and the new problem:
position = parent.frames['right'].document.body.scrollTop;
???????.scrollTo( 0, position);
<p align="center"><input type="Button" value="Full Page" name="Bt1" onClick=getScPos();></p>
The problem is that as soon as the line top.window.location.href=top.frames['right'].location.href; is executed I'm no longer I'm on a new page, and so the code after this commmand, which would scroll the page, is not executed.
So the question is: is it somehow possible to pass the sroll imfromation and scroll the page when the page is opened?
I will increase the point value to 400.