Jump to content

Archived

This topic is now archived and is closed to further replies.

tomcat01

Iframe scrolling

Recommended Posts

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 ++ ){
usleep(250000);
echo "$i<br>";
ob_flush();
flush();
}
?>

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

Thanks

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.
[code]//test.html
<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>.]
</iframe>

//test2.php
<?php
for($i=0; $i<500; $i++) echo $i."<br/>";
echo "<a name='btm'></a>";
?>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.