473,388 Members | 1,277 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

How to scroll a TextArea

Hi All,

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

Thanks,
Stefano
Jul 20 '05 #1
2 16860
"Stefano Incontri" <st********@iol.it> wrote in message
news:pa****************************@iol.it...
Hi All,

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


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

Jul 20 '05 #2
Yep
"Stefano Incontri" <st********@iol.it> wrote in message news:<pa****************************@iol.it>...
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>
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jason | last post by:
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...
5
by: gsb | last post by:
Is there a way w/ CSS or JavaScript to stop the scrollbar from showing up in a TEXTAREA? IE6+ NN6+ Thanks, gsb
5
by: pv_kannan | last post by:
Hello, I am stuck with a problem trying to mimic the behavior of a Windows Forms Readonly textbox in HMTL/ASP.NET. Basically, I would like the text to be readonly and overflow the textbox...
1
by: Rob Webster | last post by:
Hi, is there a way using JavaScript to tell a textarea to scroll to the end of it's contents? I'm implementing something that looks like messenger using web forms, after each post the chat area...
4
by: Mad Scientist Jr | last post by:
I have a textbox that i am adding to (in codebehind of ASP.NET) and need to ensure that the focus is scrolled to the bottom of the textbox each time the page refreshes, and then set focus to a 2nd...
14
by: Simon Wigzell | last post by:
I want to display HTML text inside a div and have the page open scrolled to the bottom. (My div has overflow:auto so that it appears with scroll bars) I have found this that works on a textarea:...
2
by: rjonasz | last post by:
Hey Everyone, I'm trying to scroll a textarea to the position of the caret which is below the visible area of the textarea in firefox. I have code which works in IE but the code I use for...
2
by: ScripterSam | last post by:
Hello friends, I have a html textarea with the vertical scroll buttons on. This textarea shows logs to the user.. What i need is that the textarea should show me only the latest logs... precisely...
5
by: konryd | last post by:
I want to know when a user scrolls the textarea. Since there is no such an event, I need to scroll all the ways scrolling might be invoked, that is: * by pressing keys * by moving mouse * by...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.