Capturing scroll bar usage on textarea

K

konryd

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 drag'n'dropping the scroll bar

First two are easy to implement, but the third one doesn't trigger
even document.onmousedown
I investigated on firefox and safari under osx.
Any ideas? Or at least firm confirmation that it cannot be
accomplished?

Konrad
 
J

Joost Diepenmaat

konryd said:
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 drag'n'dropping the scroll bar

First two are easy to implement, but the third one doesn't trigger
even document.onmousedown
I investigated on firefox and safari under osx.
Any ideas? Or at least firm confirmation that it cannot be
accomplished?

I haven't tried this with textareas, but the onscroll event works in
the popular browsers on elements with style overflow: scroll / auto.
 
B

Bjoern Hoehrmann

* konryd wrote in comp.lang.javascript:
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:

What is wrong with the 'scroll' event? An <textarea onscroll='...'>
certainly works for me in Internet Explorer, perhaps you missed this
event?
 
T

Thomas 'PointedEars' Lahn

Bjoern said:
* konryd wrote in comp.lang.javascript:

What is wrong with the 'scroll' event?

That it is proprietary.
An <textarea onscroll='...'>

You of all people should know that this is invalid HTML.
certainly works for me in Internet Explorer,

I wonder how you of all people could even think about advocating
invalid HTML just to satisfy Internet Explorer users.
perhaps you missed this event?

Perhaps he was thinking more clearly than you do now.


PointedEars
 
B

Bjoern Hoehrmann

* Thomas 'PointedEars' Lahn wrote in comp.lang.javascript:
That it is proprietary.

It's actually part of the HTML Events in DOM Level 2 Events. I indeed
neglected to mention that the onscroll attribute is not part of HTML4
and derived formats, thank you for adding that information.
 
T

Thomas 'PointedEars' Lahn

Bjoern said:
* Thomas 'PointedEars' Lahn wrote in comp.lang.javascript:

It's actually part of the HTML Events in DOM Level 2 Events.

Yes, indeed! Thank you for pointing this out.
I indeed neglected to mention that the onscroll attribute is not part of
HTML4 and derived formats,

However, since the `scroll' event is part of DOM Level 2 Events one can use
EventTarget::addEventListener() (except for MSHTML where assignment to
..onscroll would have to suffice due to buggy attachEvent()). Great :)
thank you for adding that information.

You are welcome.


PointedEars
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top