I found an example of scrolling an iframe content page using an onmouse over approach from the parent page. The following code works perfect until I place the example in a page which contains a FORM element, which do to the pages purpose.. needs to stay.
I've tried a few different ways of referencing the parent document, but I guess I'm missing an important item.
Could someone please clear up the missing link? Here is the code which works fine within a page *without* a Form element.
**************************
*********
* Parent page contains 2 links and the iframe
**************************
*********
<a href="#" onMouseover="scrollspeed=-
3" onMouseout="scrollspeed=0"
>right</a>
<a href="#" onMouseover="scrollspeed=3
" onMouseout="scrollspeed=0"
>left</a>
<iframe id="datamain" src="test2.htm" width=100% height=100 marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=1 scrolling=no></iframe>
**************************
**********
**************************
**********
* Content page contains the code
**************************
**********
<script language="JavaScript1.2">
//Scrollable content III- By
http://www.dynamicdrive.comvar speed, currentpos=curpos1=0,alt=1
,curpos2=-
1
function initialize(){
if (window.parent.scrollspeed
!=0){
speed = window.parent.scrollspeed
scrollwindow()
}
}
function scrollwindow(){
temp=(document.all)? document.body.scrollTop : window.pageYOffset
window.pageXOffset
alt=(alt==0)? 1 : 0
if (alt==0)
curpos1=temp
else
curpos2=temp
// window.scrollBy(0,speed) scrolling up & down
window.scrollBy(speed,0) //scrolling left & right
}
setInterval("initialize()"
,10)
</script>
**************************
**********
Thank you in advance for your time... Keith
Start Free Trial