Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IE 6: scrollTop bug fix?

Status
Not open for further replies.

TheInsider

Programmer
Jul 17, 2000
796
CA
Hello,

I am having a similar problem to the one indicated in the following thread: thread216-290699.

I have a frameset page with 3 frames defined. The first frame contains anchor tags/links which, when clicked, load the corresponding html page into the second frame
i.e.
Code:
<a href=&quot;hello.htm&quot; target=&quot;myframe2&quot;>hello</a>

The third frame has a button that, when clicked, reads the scrollTop value from the second frame.
i.e.
Code:
myvar = parent.myframe2.document.body.scrollTop;

Unfortunately there seems to be a refresh bug in Internet Explorer 6. When I select a link from frame 1 and load it into frame 2, when the code is executed in frame 3, scrollTop equals 0, no matter where the scrollbar is or how far down the page is scrolled in frame 2.

If I hit the &quot;Refresh&quot; button on the IE toolbar, scrollTop magically starts behaving itself and returns the correct value.

Is there a work-around or fix for this? I've spent a good deal of time working on this and I don't want to scrap it. My Netscape counterpart code works perfectly.

Thank you,

TheInsider
 
if I place the code to view the scrollTop in the each of the actual frame 2 pages
i.e.
Code:
myvar = document.body.scrollTop;
scrollTop will return the correct value every time, even the first time, without needing to refresh the browser.

This means that it is a frame problem. When I change the page in frame 2, I cannot reliably access properties in it from frame 3 without first refreshing the browser.

Any suggestions, other than coding the frameset page to reload itself (which would cause the page in frame 2 to reset to the default page :-( )?
 
Figured it out based on my last post: I simply got rid of the
Code:
target=&quot;&quot;
in the anchor tags and used javascript to load the pages into the frames. Then, in that same function, I called a
Code:
reload()
to the page in the third frame. This seems to work.

TheInsider
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top