473,837 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

creating a "tail" like textarea ?

Mel
i need to create a unix like "tail" function on my site.

the question:
the text is displayed in a scrolled area and a new line is added at the
end and the entire text is scrolled down so that user can see the last item
added.

i am trying to avoid displaying an HTML file and have to scroll it down,
since it does not seem to work all the time

any pointer is highly appreciated

Jul 23 '05 #1
10 3046
In article <42********@use net01.boi.hp.co m>, me**********@hp .com enlightened
us with...
i need to create a unix like "tail" function on my site.

the question:
the text is displayed in a scrolled area and a new line is added at the
end and the entire text is scrolled down so that user can see the last item
added.


Is there a reason the user can't find the End key?

End goes to the bottom.
Home goes to the top.
The keys are usually sitting in the middle section of the keyboard, above the
arrows.

If your application doesn't support End and Home, you may want to consider
fixing that. It's easier than coding JS scrolling. ;)

--
--
~kaeli~
A lot of money is tainted - It taint yours and it taint mine.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #2
Mel
user want to see the last line and does not have to page down every time a
line is inserted !!!

"kaeli" <ti******@NOSPA M.comcast.net> wrote in message
news:MP******** *************** @nntp.lucent.co m...
In article <42********@use net01.boi.hp.co m>, me**********@hp .com enlightened us with...
i need to create a unix like "tail" function on my site.

the question:
the text is displayed in a scrolled area and a new line is added at the end and the entire text is scrolled down so that user can see the last item added.
Is there a reason the user can't find the End key?

End goes to the bottom.
Home goes to the top.
The keys are usually sitting in the middle section of the keyboard, above

the arrows.

If your application doesn't support End and Home, you may want to consider
fixing that. It's easier than coding JS scrolling. ;)

--
--
~kaeli~
A lot of money is tainted - It taint yours and it taint mine.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #3
Mel wrote:
i need to create a unix like "tail" function on my site.

the question:
the text is displayed in a scrolled area and a new line is added at the
end and the entire text is scrolled down so that user can see the last item
added.

[..]

The following is rudimentary, it adds new lines to the top
rather than the bottom (which makes more sense to most users),
and displays a fixed number of entries so the bottom lines are
trimmed off.

If you want it to add to the bottom, that is possible too by
deleting the first element then adding the new one to the end.
<script type="text/javascript">
// Add more elements if a longer tail is required
var tail = new Array(10);
function tailIt(x,y){
tail.unshift(x) ;
tail.pop();
document.getEle mentById(y).inn erHTML = tail.join('<br> ');
}
</script>
<form action="">
<table border="1"><tr> <td>
<input type="text" size="30" name="inText">
</td><td>
<input type="button" value="Add to tail" onclick="
tailIt(this.for m.inText.value, 'outputCell');" >
</td><td id="outputCell " style="width: 20em;">
<script type="text/javascript">
document.write( tail.join('<br> '));
</script>
</td>
</tr>
</table>
</form>
--
Rob
Jul 23 '05 #4
"Mel" <me**********@h p.com> wrote in message
news:42******** @usenet01.boi.h p.com...
i need to create a unix like "tail" function on my site.

the question:
the text is displayed in a scrolled area and a new line is added
at the
end and the entire text is scrolled down so that user can see the
last item
added.

Textarea?

http://groups-beta.google.com/group/...af73464870f483

Tim
Jul 23 '05 #5
In article <42********@use net01.boi.hp.co m>, me**********@hp .com enlightened
us with...
user want to see the last line and does not have to page down every time a
line is inserted !!!


Is the user not adding the lines?
What is creating the text and what element is it in?

Have you looked at the scrollTo function?

--
--
~kaeli~
Murphy's Law #2030: If at first you don't succeed, destroy
all evidence that you tried.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #6
Mel
i am a newbee in JS

i did look at scrollTo function, but it does not inside a div for whatever
reason

i have :
<DIV id=MYDIV style=overflow: auto>
.....
</DIV>

i modify the contect of the div with javascript apend and that works, but
can not scroll the page down (something like a chat program)

thanks for your help

and as usual, code samples are Greeeeeeeeeeeee eaaaaaaaaat :-)

"kaeli" <ti******@NOSPA M.comcast.net> wrote in message
news:MP******** *************** *@nntp.lucent.c om...
In article <42********@use net01.boi.hp.co m>, me**********@hp .com enlightened us with...
user want to see the last line and does not have to page down every time a line is inserted !!!


Is the user not adding the lines?
What is creating the text and what element is it in?

Have you looked at the scrollTo function?

--
--
~kaeli~
Murphy's Law #2030: If at first you don't succeed, destroy
all evidence that you tried.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #7
Mel
the problem with this approach is that the user looses the context. he can
not see the entire thing without the scrolling capabilities.
"RobG" <rg***@iinet.ne t.auau> wrote in message
news:rr******** ********@news.o ptus.net.au...
Mel wrote:
i need to create a unix like "tail" function on my site.

the question:
the text is displayed in a scrolled area and a new line is added at the end and the entire text is scrolled down so that user can see the last item added.

[..]

The following is rudimentary, it adds new lines to the top
rather than the bottom (which makes more sense to most users),
and displays a fixed number of entries so the bottom lines are
trimmed off.

If you want it to add to the bottom, that is possible too by
deleting the first element then adding the new one to the end.
<script type="text/javascript">
// Add more elements if a longer tail is required
var tail = new Array(10);
function tailIt(x,y){
tail.unshift(x) ;
tail.pop();
document.getEle mentById(y).inn erHTML = tail.join('<br> ');
}
</script>
<form action="">
<table border="1"><tr> <td>
<input type="text" size="30" name="inText">
</td><td>
<input type="button" value="Add to tail" onclick="
tailIt(this.for m.inText.value, 'outputCell');" >
</td><td id="outputCell " style="width: 20em;">
<script type="text/javascript">
document.write( tail.join('<br> '));
</script>
</td>
</tr>
</table>
</form>
--
Rob

Jul 23 '05 #8
Lee
Mel said:

the problem with this approach is that the user looses the context. he can
not see the entire thing without the scrolling capabilities.


Which is also why you should post your new text *after* a trimmed quote
of the message you're responding to. (and the word is "loses").

Jul 23 '05 #9
In article <42********@use net01.boi.hp.co m>, me**********@hp .com enlightened
us with...
i am a newbee in JS

i did look at scrollTo function, but it does not inside a div for whatever
reason
That's because it's for the window object, not a div.

i have :
<DIV id=MYDIV style=overflow: auto>
....
</DIV>


Try this.

document.getEle mentById("MYDIV ").scrollTo p = document.getEle mentById
("MYDIV").scrol lHeight;

Not sure how cross-browser that is...
--
--
~kaeli~
If that phone was up your a$$, maybe you could drive a
little better!
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1440
by: cyshao | last post by:
Are there any command like Unix "tail -f " ? I'm developing a service program who writes log file in each 5 second. Now, I want to watch changes of the contaxt of the file. I know Unix porvides such program ,"tail -f ". Does Windows has similar command?
11
6673
by: Natti | last post by:
Hello, I start fileevents as soon as my tk code is invoked. My widget gets updated based on the fileevents. Most of the files do not exist in the beginning and so I get the following messages on the prompt where I invoked the perl/tk program. tail 'filename' for reading:no such file or directory. The widget update works fine. But is there anyway that I can prevent these messages from showing up. Also when information starts streaming...
21
8102
by: Owen Zhang | last post by:
What is the best way to implement "tail -f" in C or C++ and higher performance compared to either unix shell command "tail -f" or perl File::Tail ? Any suggestion appreciated. Thanks.
0
9837
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9682
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10870
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10563
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10267
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9392
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7804
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6998
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5845
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.