Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to scroll a TextArea

Reply
Thread Tools

How to scroll a TextArea

 
 
Stefano Incontri
Guest
Posts: n/a
 
      07-03-2003
Hi All,

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

Thanks,
Stefano
 
Reply With Quote
 
 
 
 
Bagbourne
Guest
Posts: n/a
 
      07-04-2003
"Stefano Incontri" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
> Hi All,
>
> how can I scroll a TextArea to its last position at the bottom?


element.scrollTop = element.scrollHeight - element.clientHeight;



 
Reply With Quote
 
 
 
 
Yep
Guest
Posts: n/a
 
      07-05-2003
"Stefano Incontri" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...

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


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.createTextRange){
rng=ta.createTextRange();
rng.collapse(false);
rng.select();
}
}
}
</script>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to add </textarea> within <textarea> tags? frank.moens@gmail.com Javascript 1 07-04-2007 04:00 PM
Textarea Inside of a textarea wperry1@gmail.com ASP General 6 02-05-2006 08:00 AM
textarea on html form won't scroll on mac - what can I do? Joe HTML 1 11-07-2004 07:34 AM
Removing carriage returns from <textarea></textarea> input Augustus ASP General 1 09-10-2003 04:55 AM



Advertisments