Jump to content


Iframe scrolling

  • Please log in to reply
3 replies to this topic

#1 tomcat01

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 28 July 2006 - 02:40 PM

Hi All,

I need help in solving how to automatically scroll content of an iFrame.
I want th iframe contant to be shown inside the frame without having to manually scroll down to it..

example code in iframe
for( $i = 0; $i < 20; $i ++ ){
echo "$i<br>";

The iframe needs to auto scroll as the counter goes to 19
Hope it makes sence...


#2 wildteen88

  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 July 2006 - 02:42 PM

In order to make it auto scroll you'll have to use javascript, howver you cannot run PHP and Javascript together. When javascript starts PHP would of finished. If you want to run them together you'll want to use ajax.

#3 tomcat01

  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 28 July 2006 - 02:46 PM

Do you know of a working example / code somwhere?

#4 Kris

  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 28 July 2006 - 02:50 PM

If you want it to just jump to the bottom of your iframe, you could just use an anchor like the following, but if you want it to scroll as it loads, yes, you need to use the ajax technique.
<iframe src="test2.php#btm" width="400" height="500" scrolling="auto" frameborder="1">
    [Your user agent does not support frames or is currently configured
    not to display frames. So <a href="http://www.getfirefox.com">get firefox</a>.]

for($i=0; $i<500; $i++) echo $i."<br/>";
echo "<a name='btm'></a>";

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users