Click to See Complete Forum and Search --> : Scrolling iframe error


stncttr908
11-25-2003, 05:27 PM
Alright, here is my problem. I have an inline frame on my main page, and rather than using ugly scrollbars I chose to use this script (http://www.dynamicdrive.com/dynamicindex17/iframescroll.htm) to scroll the content. The problem is, my university doesn't support php scripting so I have to host my guestbook elsewhere. However, whenever I load the guestbook into the frame and try to scroll it, I get a javascript error. All pages on the same domain as the main page work correctly. I have included all of the necessary code. Can someone please explain to me why this occurs?

Here is the code for the iframe.

<table border=0 cellpadding=0 cellspacing=0 width=438>
<TR>
<!--Scrollable iframe script- By Dynamic Drive-->
<!--For full source code and more DHTML scripts, visit http://www.dynamicdrive.com-->
<!--This credit MUST stay intact for use-->

<TD><img src="images\left.jpg" border=0></TD>
<TD><iframe src="news.php" id="datamain" width="363" height="287" frameborder="0" marginwidth="0" scrolling="no" name="iframe">
</iframe></TD>
<TD><img src="images\right.jpg" border=0></TD>
</TR></table>
</table><table border=0 cellpadding=0 cellspacing=0 width=438>
<TR>
<TD><img src="images\bottom.jpg" border=0></TD>
</TR>
</TABLE>

And the code included on all of the pages after the end html tag.

<!--DO NOT REMOVE BELOW SCRIPT. IT SHOULD ALWAYS APPEAR AT THE VERY END OF YOUR CONTENT-->

<script language="JavaScript1.2">

//Scrollable content III- By http://www.dynamicdrive.com

var 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
alt=(alt==0)? 1 : 0
if (alt==0)
curpos1=temp
else
curpos2=temp

window.scrollBy(0,speed)
}

setInterval("initialize()",10)

</script>Works beautifully on all pages besides the page on another domain. Makes no sense to me. Any help would be greatly appreciated.

stncttr908
11-25-2003, 05:28 PM
Damn, I guess this thread answers my question.

http://forums.webdeveloper.com/showthread.php?s=&threadid=22183

Any way around this?

diamonds
11-25-2003, 06:01 PM
yes, I think.
http://www.twinhelix.com has a script that puts a iframe inside a div, than just scrolls the div.

watch out, though.
it's not very well supported by browsers.

If you don't want to use that exact script, you can use the idea: do the above, and make sure the iframe has a style setting that hides the scrollbars (I forget it at the time, I think it is 'overflow'), than look for a script that scrolls content inside a DIV.

stncttr908
11-25-2003, 06:08 PM
I'll give that a shot. For now, I've decided to just open the guestbook itself in a new window. Thanks for the advice just the same.