471,119 Members | 1,284 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,119 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 11262
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Stefano Incontri | last post: by
1 post views Thread by Rob Webster | last post: by
4 posts views Thread by Mad Scientist Jr | last post: by
14 posts views Thread by Simon Wigzell | last post: by
3 posts views Thread by bgold12 | last post: by

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.