Scrolling

K

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
 
K

K.

U¿ytkownik "Andrew C said:
<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
 
K

K.

U¿ytkownik "Andrew C said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top