473,472 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Scrolling

K.
Hi!

I have such code:

<textarea name="text_field">very long text</textarea>

I have filled in the value of textarea field. This value is a very long
string.
I would like to scroll this textarea field into the end.

Would you like to help me how to do that?

Thank you in advance
M. from Poland
Nov 16 '06 #1
5 1512

"K." <ha************@poczta.onet.plwrote in message
news:ej**********@news.onet.pl...
Hi!

I have such code:

<textarea name="text_field">very long text</textarea>

I have filled in the value of textarea field. This value is a very long
string.
I would like to scroll this textarea field into the end.
<script ...>
var longStringElement = getElementById("longString");
....

// Whenever you want the textarea to be scrolled to the bottom, do this:
longStringElement.scrollTop = longStringElement.scrollHeight;
</script>
....
<textarea id="longString"...... </textarea>

A.
Nov 16 '06 #2
K.

Użytkownik "Andrew C" <no******@totally.made.upnapisał w wiadomości
news:SG******************@newsfe1-gui.ntli.net...
>
"K." <ha************@poczta.onet.plwrote in message
news:ej**********@news.onet.pl...
>Hi!

I have such code:

<textarea name="text_field">very long text</textarea>

I have filled in the value of textarea field. This value is a very long
string.
I would like to scroll this textarea field into the end.

<script ...>
var longStringElement = getElementById("longString");
...

// Whenever you want the textarea to be scrolled to the bottom, do this:
longStringElement.scrollTop = longStringElement.scrollHeight;
</script>
...
<textarea id="longString"...... </textarea>

A.


Hi again!

Unfortunately this example doesn`t work on IE.
I have created such code:

<script language=JavaScript>

var biografiaElement = document.getElementById("biografia");
var utworyElement = document.getElementById("utwory");

alert(biografiaElement.scrollHeight);

biografiaElement.scrollTop = biografiaElement.scrollHeight;
utworyElement.scrollTop = utworyElement.scrollHeight;
</script>

Alert gives me 0 height and I don`t know why...

Please help me.
Thank you in advance
Marcin
Nov 16 '06 #3

"K." <ha************@poczta.onet.plwrote in message
news:ej**********@news.onet.pl...
>
Użytkownik "Andrew C" <no******@totally.made.upnapisał w wiadomości
news:SG******************@newsfe1-gui.ntli.net...
>>
"K." <ha************@poczta.onet.plwrote in message
news:ej**********@news.onet.pl...
>>Hi!

I have such code:

<textarea name="text_field">very long text</textarea>

I have filled in the value of textarea field. This value is a very long
string.
I would like to scroll this textarea field into the end.

<script ...>
var longStringElement = getElementById("longString");
...

// Whenever you want the textarea to be scrolled to the bottom, do this:
longStringElement.scrollTop = longStringElement.scrollHeight;
</script>
...
<textarea id="longString"...... </textarea>

A.



Hi again!

Unfortunately this example doesn`t work on IE.
I have created such code:

<script language=JavaScript>

var biografiaElement = document.getElementById("biografia");
var utworyElement = document.getElementById("utwory");

alert(biografiaElement.scrollHeight);

biografiaElement.scrollTop = biografiaElement.scrollHeight;
utworyElement.scrollTop = utworyElement.scrollHeight;
</script>

Alert gives me 0 height and I don`t know why...

Please help me.
Thank you in advance
Marcin
Try:

<textarea id="biografia" readonly="true" ...>
....
</textarea>

A.
Nov 16 '06 #4
K.

Użytkownik "Andrew C" <no******@totally.made.upnapisał w wiadomości
news:Pl*******************@newsfe2-gui.ntli.net...
>
"K." <ha************@poczta.onet.plwrote in message
news:ej**********@news.onet.pl...
>>
Użytkownik "Andrew C" <no******@totally.made.upnapisał w wiadomości
news:SG******************@newsfe1-gui.ntli.net...
>>>
"K." <ha************@poczta.onet.plwrote in message
news:ej**********@news.onet.pl...
Hi!

I have such code:

<textarea name="text_field">very long text</textarea>

I have filled in the value of textarea field. This value is a very long
string.
I would like to scroll this textarea field into the end.

<script ...>
var longStringElement = getElementById("longString");
...

// Whenever you want the textarea to be scrolled to the bottom, do this:
longStringElement.scrollTop = longStringElement.scrollHeight;
</script>
...
<textarea id="longString"...... </textarea>

A.



Hi again!

Unfortunately this example doesn`t work on IE.
I have created such code:

<script language=JavaScript>

var biografiaElement = document.getElementById("biografia");
var utworyElement = document.getElementById("utwory");

alert(biografiaElement.scrollHeight);

biografiaElement.scrollTop = biografiaElement.scrollHeight;
utworyElement.scrollTop = utworyElement.scrollHeight;
</script>

Alert gives me 0 height and I don`t know why...

Please help me.
Thank you in advance
Marcin

Try:

<textarea id="biografia" readonly="true" ...>
...
</textarea>

A.
Unfortunately this example doesn`t give me a solution I would like to have.
I would like to have textarea element with updating possibilites.

I tried

var elem=document.getElementById("biografia");

if(elem)
{
elem.focus();
MoveToEnd(elem);
elem.focus();
}

but also without results.
I use IE 6.0.

Please help me, I cannot find any properly-working solution in post
archieves
Thank you Andrew for helping
Marcin
Nov 16 '06 #5

"K." <ha************@poczta.onet.plwrote in message
news:ej**********@news.onet.pl...
>
Użytkownik "Andrew C" <no******@totally.made.upnapisał w wiadomości
news:Pl*******************@newsfe2-gui.ntli.net...
>>
"K." <ha************@poczta.onet.plwrote in message
news:ej**********@news.onet.pl...
>>>
Użytkownik "Andrew C" <no******@totally.made.upnapisał w wiadomości
news:SG******************@newsfe1-gui.ntli.net...

"K." <ha************@poczta.onet.plwrote in message
news:ej**********@news.onet.pl...
Hi!
>
I have such code:
>
<textarea name="text_field">very long text</textarea>
>
I have filled in the value of textarea field. This value is a very
long string.
I would like to scroll this textarea field into the end.

<script ...>
var longStringElement = getElementById("longString");
...

// Whenever you want the textarea to be scrolled to the bottom, do
this:
longStringElement.scrollTop = longStringElement.scrollHeight;
</script>
...
<textarea id="longString"...... </textarea>

A.


Hi again!

Unfortunately this example doesn`t work on IE.
I have created such code:

<script language=JavaScript>

var biografiaElement = document.getElementById("biografia");
var utworyElement = document.getElementById("utwory");

alert(biografiaElement.scrollHeight);

biografiaElement.scrollTop = biografiaElement.scrollHeight;
utworyElement.scrollTop = utworyElement.scrollHeight;
</script>

Alert gives me 0 height and I don`t know why...

Please help me.
Thank you in advance
Marcin

Try:

<textarea id="biografia" readonly="true" ...>
...
</textarea>

A.

Unfortunately this example doesn`t give me a solution I would like to
have.
I would like to have textarea element with updating possibilites.

I tried

var elem=document.getElementById("biografia");

if(elem)
{
elem.focus();
MoveToEnd(elem);
elem.focus();
}

but also without results.
I use IE 6.0.

Please help me, I cannot find any properly-working solution in post
archieves
Thank you Andrew for helping
Marcin
If you need to add content to the textarea programmatically, readonly won't
stop you, but it does seem to allow the '...scrollTop = ...scrollHeight'
trick to work in IE -- at least it did in IE7 for me.

Only if you need for the user to add content via the keyboard will readonly
cause you difficulties. Even then, one work-around may be to switch readonly
off and on at different times (e.g. set readonly to true briefly when you
add content programmatically and need to auto-scroll to the bottom).

Does this help?

A.
Nov 16 '06 #6

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

Similar topics

1
by: Midas NDT Sales | last post by:
I have been looking at a simple example of a scrolling text box (the one in the SAM book) as below: <script language="JavaScript"> var pos=100; function Scroll() { if...
1
by: Kirk | last post by:
Is it possible to stop horizontal scrolling whilst still maintaining vertical scrolling within an <IFRAME> ? Within each page of my site I have an IFRAME for content. For some pages there is...
44
by: Jim M | last post by:
I have had great success with using <iframe> with overflow-y set to auto. I can get a similar look with the <iframe> tag. BUT... In all cases I need to have fixed heights. Is there a way to...
1
by: Tim Frawley | last post by:
I have a large form with many controls, almost like legal size paper in height. Just so I can head these off, I am not looking for suggestions to the effect of using Tab controls, multi-window...
2
by: P2P | last post by:
Hi I am wondering if someone know of a free cross-browsers vertical scrolling script that - is cross cross-browsers - will call the scrolling content from an external html page or from a...
4
by: Keith Bentrup | last post by:
Hi all, I wrote a simple search function to find text in a textarea where not all the text is visible (ie. the text box displays 10 lines but there may be more than 1000 lines to search). I can...
1
by: atif | last post by:
Hi, I m new to CSharp.. so may be my preliminary questions look stupid.. but plz help me.. I want to drag controls like buttons or some other user controls over form.. i have set form's...
5
by: PythonistL | last post by:
I am a newbie with Javascript. I have this simple script for scrolling text <HTML> <HEAD> <TITLE>Scrolling Message Script</TITLE> <SCRIPT language="JavaScript"><!-- var msg = 'My scrolling...
3
by: Chamnap | last post by:
Hello everybody, I have one problem. I want to do something after the user finished scrolling. The scroll event fires whenever the user is scrolling. I don't want this actually. Does anyone has...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.