Solved

Scroll down as printing

Posted on 2004-08-14
3
169 Views
Last Modified: 2006-11-17
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
Comment
Question by:bmbsa
  • 2
3 Comments
 
LVL 13

Expert Comment

by:StormyWaters
Comment Utility
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
 
LVL 13

Expert Comment

by:StormyWaters
Comment Utility
Take a look at http://www.mediacollege.com/internet/javascript/page/scroll.html for a way to scroll the page in Javascript.
0
 
LVL 4

Accepted Solution

by:
aratani earned 45 total points
Comment Utility
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

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now