Click to See Complete Forum and Search --> : scrollbar position in a text area


angrytuna
07-29-2003, 06:34 PM
Hi,
If you have a textarea tag where the content is larger than the textarea's size, can you set the scroll position of the field's content? An absurd example:

<textarea name="textarea" cols='10' rows='5'>
Sing, O goddess, the anger of Achilles son of Peleus, that brought
countless ills upon the Achaeans. Many a brave soul did it send
hurrying down to Hades, and many a hero did it yield a prey to dogs
and vultures, for so were the counsels of Jove fulfilled from the
day on which the son of Atreus, king of men, and great Achilles, first
fell out with one another.
And which of the gods was it that set them on to quarrel? It was the
son of Jove and Leto; for he was angry with the king and sent a
pestilence upon the host to plague the people, because the son of
Atreus had dishonoured Chryses his priest. Now Chryses had come to the
ships of the Achaeans to free his daughter, and had brought with him a
great ransom: moreover he bore in his hand the sceptre of Apollo
wreathed with a suppliant's wreath and he besought the Achaeans, but
most of all the two sons of Atreus, who were their chiefs.
"Sons of Atreus," he cried, "and all other Achaeans, may the gods
who dwell in Olympus grant you to sack the city of Priam, and to reach
your homes in safety; but free my daughter, and accept a ransom for
her, in reverence to Apollo, son of Jove."
On this the rest of the Achaeans with one voice were for
respecting the priest and taking the ransom that he offered; but not
so Agamemnon, who spoke fiercely to him and sent him roughly away.
"Old man," said he, "let me not find you tarrying about our ships, nor
yet coming hereafter. Your sceptre of the god and your wreath shall
profit you nothing. I will not free her. She shall grow old in my
house at Argos far from her own home, busying herself with her loom
and visiting my couch; so go, and do not provoke me or it shall be the
worse for you."
</textarea>

Could you use javascript to set the textarea's scrollbar, say, halfway down this text, or perhaps match a word occurrence, and scroll to the word automatically?

xataku_nakusute
07-29-2003, 08:20 PM
your questions a bit vague....but these are my 2 possible solutions:

a)

try using a div with scrolling: auto in a style section in your head area.....

<style type="text/css">
div
{
scrolling: auto;
height: 50px;
}
</style>
</head>
<body>
<div wrap="virtual">
Sing, O goddess, the anger of Achilles son of Peleus, that brought
countless ills upon the Achaeans. Many a brave soul did it send
hurrying down to Hades, and many a hero did it yield a prey to dogs
and vultures, for so were the counsels of Jove fulfilled from the
day on which the son of Atreus, king of men, and great Achilles, first
fell out with one another.
And which of the gods was it that set them on to quarrel? It was the
son of Jove and Leto; for he was angry with the king and sent a
pestilence upon the host to plague the people, because the son of
Atreus had dishonoured Chryses his priest. Now Chryses had come to the
ships of the Achaeans to free his daughter, and had brought with him a
great ransom: moreover he bore in his hand the sceptre of Apollo
wreathed with a suppliant's wreath and he besought the Achaeans, but
most of all the two sons of Atreus, who were their chiefs.
"Sons of Atreus," he cried, "and all other Achaeans, may the gods
who dwell in Olympus grant you to sack the city of Priam, and to reach
your homes in safety; but free my daughter, and accept a ransom for
her, in reverence to Apollo, son of Jove."
On this the rest of the Achaeans with one voice were for
respecting the priest and taking the ransom that he offered; but not
so Agamemnon, who spoke fiercely to him and sent him roughly away.
"Old man," said he, "let me not find you tarrying about our ships, nor
yet coming hereafter. Your sceptre of the god and your wreath shall
profit you nothing. I will not free her. She shall grow old in my
house at Argos far from her own home, busying herself with her loom
and visiting my couch; so go, and do not provoke me or it shall be the
worse for you."
</div>

and thatll allow the div to have a scrollbar(as long as you specify a height within the style section)....

and if you mean making the scrollbar lower down on the text, heres an example of it that i made on my clients site(that im still in progress on)....http://www.todaysendmusic.com/lyrics/fme.html

the two buttons are actually images

angrytuna
07-30-2003, 05:50 PM
That scrollTop property was what I was looking for. Thanks!

AT

xataku_nakusute
07-31-2003, 01:17 AM
np