automatically scroll to bottom of textarea

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jason@cyberpine.com

    #1

    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.
  • johkar

    #2
    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">ajkldf kjasd

    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.createTextRa nge){
    rng=ta.createTe xtRange();
    rng.collapse(fa lse);
    rng.select();
    }
    }
    }
    f('textfield');
    </script>



    <jason@cyberpin e.com> wrote in message
    news:ef0a04d7.0 310030721.35720 e2d@posting.goo gle.com...[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]


    Comment

    Working...