Connecting Tech Pros Worldwide Forums | Help | Site Map

Capturing scroll bar usage on textarea

konryd
Guest
 
Posts: n/a
#1: Jun 27 '08
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

Joost Diepenmaat
Guest
 
Posts: n/a
#2: Jun 27 '08

re: Capturing scroll bar usage on textarea


konryd <konryd@gmail.comwrites:
Quote:
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.

--
Joost Diepenmaat | blog: http://joost.zeekat.nl/ | work: http://zeekat.nl/
Bjoern Hoehrmann
Guest
 
Posts: n/a
#3: Jun 27 '08

re: Capturing scroll bar usage on textarea


* konryd wrote in comp.lang.javascript:
Quote:
>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?
--
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#4: Jun 27 '08

re: Capturing scroll bar usage on textarea


Bjoern Hoehrmann wrote:
Quote:
* konryd wrote in comp.lang.javascript:
Quote:
>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?
That it is proprietary.
Quote:
An <textarea onscroll='...'>
You of all people should know that this is invalid HTML.
Quote:
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.
Quote:
perhaps you missed this event?
Perhaps he was thinking more clearly than you do now.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Bjoern Hoehrmann
Guest
 
Posts: n/a
#5: Jun 27 '08

re: Capturing scroll bar usage on textarea


* Thomas 'PointedEars' Lahn wrote in comp.lang.javascript:
Quote:
>Bjoern Hoehrmann wrote:
Quote:
>* konryd wrote in comp.lang.javascript:
Quote:
>>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?
>
>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.
--
Björn Höhrmann · mailto:bjoern@hoehrmann.de · http://bjoern.hoehrmann.de
Weinh. Str. 22 · Telefon: +49(0)621/4309674 · http://www.bjoernsworld.de
68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · http://www.websitedev.de/
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#6: Jun 27 '08

re: Capturing scroll bar usage on textarea


Bjoern Hoehrmann wrote:
Quote:
* Thomas 'PointedEars' Lahn wrote in comp.lang.javascript:
Quote:
>Bjoern Hoehrmann wrote:
Quote:
>>* 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?
>That it is proprietary.
>
It's actually part of the HTML Events in DOM Level 2 Events.
Yes, indeed! Thank you for pointing this out.
Quote:
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 :)
Quote:
thank you for adding that information.
You are welcome.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
Closed Thread