Scrolling log files

C

Chris

I got a log file I'd like to scroll on the screen as new entries are added
to the bottom. So far, I've written a little code that grabs the last X
lines from the file and displays them in a < textarea >. The user hits
"refresh" to see more recent entries.

The trouble is that I can't get the textarea to scroll to the bottom so the
most recent entries are visible.

1. Is there a way to get textarea elements to automatically put the cursor
at the bottom?
2. More generally, is there a better way to do this user interface?
 
A

Andreas Paasch

Chris said:
I got a log file I'd like to scroll on the screen as new entries are added
to the bottom. So far, I've written a little code that grabs the last X
lines from the file and displays them in a < textarea >. The user hits
"refresh" to see more recent entries.

The trouble is that I can't get the textarea to scroll to the bottom so
the most recent entries are visible.

1. Is there a way to get textarea elements to automatically put the cursor
at the bottom?
2. More generally, is there a better way to do this user interface?

I assume you use some server side coding to do that too, so why not toss
your output from the script into an array and reverse that array?
Then you output the reversed array and the newest entries of your logfiles
will always be at the top of the textarea.

/Andreas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top