PDA

View Full Version : how to scroll multiple iFrames ????



eron
03-08-2006, 07:42 PM
hei guys,
I need to make this up, I have three iFrames on my page FRAME_1, FRAME_2 and FRAME_3, and I need to know how to make both FRAME_1 AND FRAME_2 scroll when scrolling FRAME_3 using its scroll bar...

some one can help me?

Twey
03-08-2006, 08:12 PM
I don't think there's a scroll event handler, so we'll have to poll this one.
<script type="text/javascript">
function checkScroll() {
var controlElement = document.frames['FRAME_1'];
var xoffset = (document.all) ? controlElement.document.body.scrollLeft : controlElement.pageXOffset,
yoffset = (document.all) ? controlElement.document.body.scrollTop:controlElement.pageYOffset;
document.frames['FRAME_3'].scrollTo(xoffset, yoffset);
document.frames['FRAME_2'].scrollTo(xoffset, yoffset);
}

window.setInterval("checkScroll()", 200);
</script>

eron
03-09-2006, 02:01 PM
I don't think there's a scroll event handler, so we'll have to poll this one.
<script type="text/javascript">
function checkScroll() {
var controlElement = document.frames['FRAME_1'];
var xoffset = (document.all) ? controlElement.document.body.scrollLeft : controlElement.pageXOffset,
yoffset = (document.all) ? controlElement.document.body.scrollTop:controlElement.pageYOffset;
document.frames['FRAME_3'].scrollTo(xoffset, yoffset);
document.frames['FRAME_2'].scrollTo(xoffset, yoffset);
}

window.setInterval("checkScroll()", 200);
</script>

ohh man... that's perfect... its all that I need... Thank you so much... u helped me a lot man... woks more than perfect... thank u very much...

Alex.

Amarnath
07-10-2009, 09:53 AM
Thank you very much..i was in need of this script