How to scroll a TextArea

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Stefano Incontri

    How to scroll a TextArea

    Hi All,

    how can I scroll a TextArea to its last position at the bottom?

    Thanks,
    Stefano
  • Bagbourne

    #2
    Re: How to scroll a TextArea

    "Stefano Incontri" <stefano.in@iol .it> wrote in message
    news:pan.2003.0 7.03.17.37.34.5 10613@iol.it...[color=blue]
    > Hi All,
    >
    > how can I scroll a TextArea to its last position at the bottom?[/color]

    element.scrollT op = element.scrollH eight - element.clientH eight;



    Comment

    • Yep

      #3
      Re: How to scroll a TextArea

      "Stefano Incontri" <stefano.in@iol .it> wrote in message news:<pan.2003. 07.03.17.37.34. 510613@iol.it>. ..
      [color=blue]
      > how can I scroll a TextArea to its last position at the bottom?[/color]

      In IE, collapsing a TEXTAREA range to the end and selecting it should
      result into a scrolldown; as for other browsers I don't think it's
      currently doable.


      <textarea id="ta" rows="5" cols="30">
      Hello World
      Hello World
      Hello World
      Hello World
      Hello World
      Hello World
      Hello World
      Hello World
      Hello World
      </textarea>

      <input type="button" value="scroll" onclick="f('ta' )" />

      <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();
      }
      }
      }
      </script>

      Comment

      Working...