Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 185
  • Last Modified:

Scroll down as printing

Hi folks,

I am using this code to print the contents of a file

<?
....
while (!feof($file) ){
        $buffer = fgets($fp, 1024);
        print $buffer.'<br>';
        flush();
}


How can I scroll down the page as printing?

Thanks
0
bmbsa
Asked:
bmbsa
  • 2
1 Solution
 
StormyWatersCommented:
PHP is a serverside language, so everything is done printing before the file ever gets to the user. I suppose you could scroll the page using javascript.
0
 
StormyWatersCommented:
Take a look at http://www.mediacollege.com/internet/javascript/page/scroll.html for a way to scroll the page in Javascript.
0
 
arataniCommented:
Actually this is what you could try,

<?
....
while (!feof($file) ){
        $buffer = fgets($fp, 1024);
        print $buffer.'<br>';
        print "<script language = 'javascript'>window.scrollBy(0,50);</script>";
        flush();
}

You might have to change that value in the scrollBy function to get it right.

Take care

AJ
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now