Capturing scroll bar usage on textarea

Discussion in 'Javascript' started by konryd, May 19, 2008.

  1. konryd

    konryd Guest

    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
     
    konryd, May 19, 2008
    #1
    1. Advertising

  2. konryd <> writes:

    > 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/
     
    Joost Diepenmaat, May 19, 2008
    #2
    1. Advertising

  3. * 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?
    --
    Björn Höhrmann · mailto: · 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/
     
    Bjoern Hoehrmann, May 19, 2008
    #3
  4. 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.

    > 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
    --
    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>
     
    Thomas 'PointedEars' Lahn, May 20, 2008
    #4
  5. * 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. 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: · 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/
     
    Bjoern Hoehrmann, May 20, 2008
    #5
  6. Bjoern Hoehrmann wrote:
    > * 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.

    > 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
    --
    realism: HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness: XHTML 1.1 as application/xhtml+xml
    -- Bjoern Hoehrmann
     
    Thomas 'PointedEars' Lahn, May 20, 2008
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George
    Replies:
    4
    Views:
    522
    George
    Feb 13, 2004
  2. Matt
    Replies:
    0
    Views:
    3,566
  3. John Hann
    Replies:
    0
    Views:
    6,116
    John Hann
    Aug 21, 2004
  4. Matt
    Replies:
    9
    Views:
    70,996
  5. gsb

    TEXTAREA Scroll Bar

    gsb, Dec 10, 2003, in forum: Javascript
    Replies:
    4
    Views:
    119
Loading...

Share This Page