To synchronize the scrolling of two frames
You can use
setInterval
to periodically read the viewport coordinates of one frame and then
scroll the other frame to that position with
frameReference.scrollTo(x, y)
in NN4, NN6, Opera4/5 and IE4+.
In NN4 and Opera4/5 the code set up in the frameset document works even
when the frames are on a different host, with NN6 and IE4+ the frameset
needs to come from the same host as the frames.
<HTML>
<HEAD>
<TITLE>
frame scrolling synchronization
</TITLE>
<SCRIPT>
var tid;
function initScrollSynchronization () {
tid = setInterval('syncFrame()', 25);
}
function syncFrame () {
if (document.all && !window.opera) {
var scrollTop = frame0.document.body.scrollTop;
var scrollLeft = frame0.document.body.scrollLeft;
}
else {
var scrollTop = frame0.pageYOffset;
var scrollLeft = frame0.pageXOffset;
}
frame1.scrollTo (scrollLeft, scrollTop);
}
</SCRIPT>
</HEAD>
<FRAMESET COLS="50%, 50%" ONLOAD="initScrollSynchronization()">
<FRAME NAME="frame0" SRC="file1.html">
<FRAME NAME="frame1" SRC="file2.html">
</FRAMESET>
</HTML> Moira
"Those that stop learning, stop living."