nyaraka
02-04-2008, 06:23 PM
Please keep in mind that I am -very- new to JavaScript, and furthermore, did not write this code myself. I modified a tutorial code posted on some forum.
What I'm trying to do is use two images (up and down arrows) to control scrolling within an iframe. It works perfectly half the time, and the other half the time, it doesn't work at all. (This is on Internet Explorer 6.0.) Is this a loading issue, or is it something else entirely?
CODE:
In the header of the page containing the iframe and the arrows:
<script type="text/javascript">
var staticscrollspeed=3
var xcurrentscrollspeed=0
var ycurrentscrollspeed=0
function scroll(){
document.content.scrollBy(xcurrentscrollspeed,ycurrentscrollspeed)
}
setInterval("scroll()",20)
</script>
The two images:
<a onmouseover="ycurrentscrollspeed=-staticscrollspeed" onmouseout="ycurrentscrollspeed=0"> <img src="images/scroll-up.gif" name="up" border="0" style="position:absolute; left:66px; top:274px" z-index="9" /></a>
<a onmouseover="ycurrentscrollspeed=staticscrollspeed" onmouseout="ycurrentscrollspeed=0"><img src="images/scroll-down.gif" name="down" border="0" style="position:absolute; left:66px; top:324px" z-index="9" /></a></td>
The iFrame:
<iframe style="position:absolute; left:171px; top:270px" scrolling="no" z-index="5" src="home.html" name="content" allowtransparency="true" frameborder="0" height="270" width="570"></iframe>
Thank you!
What I'm trying to do is use two images (up and down arrows) to control scrolling within an iframe. It works perfectly half the time, and the other half the time, it doesn't work at all. (This is on Internet Explorer 6.0.) Is this a loading issue, or is it something else entirely?
CODE:
In the header of the page containing the iframe and the arrows:
<script type="text/javascript">
var staticscrollspeed=3
var xcurrentscrollspeed=0
var ycurrentscrollspeed=0
function scroll(){
document.content.scrollBy(xcurrentscrollspeed,ycurrentscrollspeed)
}
setInterval("scroll()",20)
</script>
The two images:
<a onmouseover="ycurrentscrollspeed=-staticscrollspeed" onmouseout="ycurrentscrollspeed=0"> <img src="images/scroll-up.gif" name="up" border="0" style="position:absolute; left:66px; top:274px" z-index="9" /></a>
<a onmouseover="ycurrentscrollspeed=staticscrollspeed" onmouseout="ycurrentscrollspeed=0"><img src="images/scroll-down.gif" name="down" border="0" style="position:absolute; left:66px; top:324px" z-index="9" /></a></td>
The iFrame:
<iframe style="position:absolute; left:171px; top:270px" scrolling="no" z-index="5" src="home.html" name="content" allowtransparency="true" frameborder="0" height="270" width="570"></iframe>
Thank you!