|  | Capturing scroll bar usage on textarea |  | |
| | | konryd |  |
| Posted: Mon May 19, 2008 10:38 pm Post subject: Capturing scroll bar usage on textarea |  |
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 |  |
| Posted: Mon May 19, 2008 10:38 pm Post subject: Re: Capturing scroll bar usage on textarea |  |
konryd <konryd@gmail.com> writes:
| 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: LINK | work: LINK |
| |
| | | Bjoern Hoehrmann |  |
| Posted: Mon May 19, 2008 10:38 pm Post subject: 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 · LINK Weinh. Str. 22 · Telefon: +49(0)621/4309674 · LINK 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · LINK |
| |
| | | Thomas 'PointedEars' Lahn |  |
| Posted: Tue May 20, 2008 6:59 am Post subject: Re: Capturing scroll bar usage on textarea |  |
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.
| 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 |  |
| Posted: Tue May 20, 2008 8:21 am Post subject: Re: Capturing scroll bar usage on textarea |  |
* Thomas 'PointedEars' Lahn wrote in comp.lang.javascript:
| Quote: | Bjoern Hoehrmann wrote: * 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. 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 · LINK Weinh. Str. 22 · Telefon: +49(0)621/4309674 · LINK 68309 Mannheim · PGP Pub. KeyID: 0xA4357E78 · LINK |
| |
| | | Thomas 'PointedEars' Lahn |  |
| Posted: Tue May 20, 2008 8:49 am Post subject: Re: Capturing scroll bar usage on textarea |  |
| |  | |
Bjoern Hoehrmann wrote:
| Quote: | * Thomas 'PointedEars' Lahn wrote in comp.lang.javascript: Bjoern Hoehrmann wrote: * 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 |
| |
|
|