Menu
Hi guys,
I just want to know how do i control an iframe scroll property from a parent window.
Thanks in advance
tanveer
<SCRIPT LANGUAGE="JavaScript">
Ok, here ya go. Two parts:
Part 1 - the main page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function verScroll(dir, spd, loop) {
loop = true;
direction = "left";
speed = 10;
scrolltimer = null;
if (document.layers) {
var page = eval(window.content.contentLayer);
}
else {
if (document.all) {
var page = eval(window.content.contentLayer.style);
}
else {
if (document.getElementById) {
var page= eval("document.getElementById('window.content.contentLayer').style");
}
}
}
direction = dir;
speed = parseInt(spd);
var y_pos = parseInt(page.left);
if (loop == true) {
if (direction == "right") {
page.left = (y_pos - (speed));
} else {
if (direction == "left" && y_pos < 3) {
page.left = (y_pos + (speed));
} else {
if (direction == "left") {
page.left = 1;
}
}
}
scrolltimer = setTimeout("verScroll(direction,speed)", 1);
}
}
function stopScroll() {
loop = false;
clearTimeout(scrolltimer);
}
// End -->
</SCRIPT>
</head>
<body>
<TABLE BORDER=0>
<TR>
<TD><A HREF="#" onMouseOver="verScroll('left','5','true')" onMouseOut="stopScroll()"><<<</A></TD>
<TD><A HREF="#" onMouseOver="verScroll('right','5','true')" onMouseOut="stopScroll()">>>></a></A></TD>
</TR>
</TABLE>
<iframe frameborder="0" name="content" id="content" width="400" height="400" scrolling="auto" src="test_frame.html"></iframe>
</body>
</html>
Part 2 - the iframe page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<DIV ID="contentLayer" STYLE="position:absolute; width:137px; z-index:1; left: 0px; top: 0px">
<table width="600"><tr><td>
Xxxxx x xx xxx x xx xx xx x xxxx xx xxx xx xx xxxx xx xxxx x xx xxxx xxx x xxxx x x xxx xx xxxxx x xx xxx x xx xx xx x xxxx xx xxx xx xx xxxx xx xxxx x xx xxxx xxx x xxxx x x xxx xx xxxxx x xx xxx x xx xx xx x xxxx xx xxx xx xx xxxx xx xxxx x xx xxxx xxx x xxxx x x xxx xx xxxxx x xx xxx x xx xx xx x xxxx xx xxx xx xx xxxx xx xxxx x xx xxxx xxx x xxxx x x xxx xx xxxxx x xx xxx x xx xx xx x xxxx xx xxx xx xx xxxx xx xxxx x xx xxxx xxx x xxxx x x xxx xx xxxxx x xx xxx x xx xx xx x xxxx xx xxx xx xx xxxx xx xxxx x xx xxxx xxx x xxxx x x xxx xx xxxxx x xx xxx x xx xx xx x xxxx xx xxx xx xx xxxx xx xxxx x xx xxxx xxx x xxxx x x xxx xx xxxxx x xx xxx x xx xx xx x xxxx xx xxx xx xx xxxx xx xxxx x xx xxxx xxx x xxxx x x xxx xx xxxxx x xx xxx x xx xx xx x xxxx xx xxx xx xx xxxx xx xxxx x xx xxxx xxx x xxxx x x xxx xx x
</td></tr></table>
</div>
</body>
</html>[/QUOTE]
0.1.9 — BETA 5.19