SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Zealot maxdream01's Avatar
    Join Date
    Feb 2011
    Location
    USA
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    scroll to bottom of textarea

    ok so i have a textarea which is constantly being added to from a text file with the php include command. that textarea is in one .php file which is also being constantly refreshed every 20 seconds. another page on the site is showing this textarea with an iframe (no scroll). what i want is that after each refresh the scroller in the textarea automatically goes to the bottom of the textarea.

    ive tried to search this but nothing seems to work i also tried to use this

    textareaname.scrollTop = textareaname.scrollHeight;

    but im not sure how that fits into my page and if it even works

    also i found this

    <textarea id="ta">___</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('ta');
    </script>
    but it only works in ie

    thanks
    Last edited by maxdream01; May 1, 2011 at 08:37. Reason: more information

  2. #2
    SitePoint Zealot maxdream01's Avatar
    Join Date
    Feb 2011
    Location
    USA
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    also the textarea is not in a form and has no buttons

  3. #3
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,526
    Mentioned
    83 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by maxdream01 View Post
    but it only works in ie
    This resource should be of some help then - Introduction to Range
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •