Connecting Tech Pros Worldwide Forums | Help | Site Map

automatically scroll to bottom of textarea

jason@cyberpine.com
Guest
 
Posts: n/a
#1: Jul 20 '05
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.

johkar
Guest
 
Posts: n/a
#2: Jul 20 '05

re: automatically scroll to bottom of textarea


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

<jason@cyberpine.com> wrote in message
news:ef0a04d7.0310030721.35720e2d@posting.google.c om...[color=blue]
> 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.[/color]


Closed Thread