473,387 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

automatically scroll to bottom of textarea

Hello.

I've written this web application in asp.net and have a textarea what
I will use like a chat box. The box will be frequently refreshing. I
need the textarea to *automatically* scroll to the bottom or start at
the bottom displaying the last message sent. I am being told there is
no way to do this in asp.net and that I will have to do it in
javascript. Does anybody have any sample code on how to do this?

Many thanks for any help or information.
Jul 20 '05 #1
1 11400
Credit for this goes to Yep from a response in July. IE.

John

<textarea id="textfield" rows="4">ajkldfkjasd

l;ajdf;lksdjaf

lajdfsl;jasd;lf

;lasdfj;ljasdf
</textarea>
<script type="text/javascript">
function f(ta_id){
var d=document, ta, rng;
if(d.all){
ta=d.all[ta_id];
if(ta && ta.createTextRange){
rng=ta.createTextRange();
rng.collapse(false);
rng.select();
}
}
}
f('textfield');
</script>

http://groups.google.com/groups?hl=e...ang.javascript

<ja***@cyberpine.com> wrote in message
news:ef**************************@posting.google.c om...
Hello.

I've written this web application in asp.net and have a textarea what
I will use like a chat box. The box will be frequently refreshing. I
need the textarea to *automatically* scroll to the bottom or start at
the bottom displaying the last message sent. I am being told there is
no way to do this in asp.net and that I will have to do it in
javascript. Does anybody have any sample code on how to do this?

Many thanks for any help or information.

Jul 20 '05 #2

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

Similar topics

2
by: Stefano Incontri | last post by:
Hi All, how can I scroll a TextArea to its last position at the bottom? Thanks, Stefano
1
by: Rob Webster | last post by:
Hi, is there a way using JavaScript to tell a textarea to scroll to the end of it's contents? I'm implementing something that looks like messenger using web forms, after each post the chat area...
4
by: Mad Scientist Jr | last post by:
I have a textbox that i am adding to (in codebehind of ASP.NET) and need to ensure that the focus is scrolled to the bottom of the textbox each time the page refreshes, and then set focus to a 2nd...
14
by: Simon Wigzell | last post by:
I want to display HTML text inside a div and have the page open scrolled to the bottom. (My div has overflow:auto so that it appears with scroll bars) I have found this that works on a textarea:...
1
by: zhifchen | last post by:
Hi guys, I have some problem about my little http/javascript/xmlhttpreq based chatroom program: I use xmlhttpreq object to add data to the current html file. It will add to a specifiy place, like...
7
by: carllucas | last post by:
I wish to create a textarea which will extend its height according to how many lines there in it so that one won't need to scroll. To do this I have created a textarea thus: <textarea...
2
by: ScripterSam | last post by:
Hello friends, I have a html textarea with the vertical scroll buttons on. This textarea shows logs to the user.. What i need is that the textarea should show me only the latest logs... precisely...
3
by: bgold12 | last post by:
How can I test if a vertical scroll bar is at the bottom of the range? I know that... document.getElementById('mydiv').scrollHeight ....returns the range, and... ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...

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.