Detecting if onscroll events working / supported in Firefox

Discussion in 'Javascript' started by Mark Szlazak, Mar 29, 2005.

  1. Mark Szlazak

    Mark Szlazak Guest

    Is there a way to detect if an textarea onscroll event is working in
    Firefox (or Mozilla). I know that there is an onscroll event bubbling
    bug with current vesions of these browsers so I want to detect this
    problem with a test like "if (textarea.onscroll == 'undefined' ||
    !textarea.onscroll) {}." Any help would be appreciated.
    Mark Szlazak, Mar 29, 2005
    #1
    1. Advertising

  2. Mark Szlazak

    Mark Szlazak Guest

    Mark Szlazak wrote:
    > Is there a way to detect if an textarea onscroll event is working in
    > Firefox (or Mozilla). I know that there is an onscroll event bubbling
    > bug with current vesions of these browsers so I want to detect this
    > problem with a test like "if (textarea.onscroll == 'undefined' ||
    > !textarea.onscroll) {}." Any help would be appreciated.


    I've tried the following code and it seems to work in IE and Firefox on
    a Win2k box. Does anyone see problems with it as a test used for
    branching to workaround code when a buggy Moz/Firefox browser is being
    used?

    <html>
    <head>
    <script>
    function isBubbling (ta) {
    var bubbling = false, str = '';

    ta.onscroll = function () { bubbling = true; }

    for (var i=0; i<ta.rows; i++) str += '\n';
    ta.value = str;
    ta.scrollTop = ta.scrollHeight;
    ta.scrollTop = 0;

    ta.value = "";
    return bubbling;
    }

    onload = function ()
    {
    var ta = document.getElementById('ta');

    if (isBubbling(ta))
    {
    alert('bubbling');
    }
    else
    {
    alert('not bubbling');
    }
    }
    </script>
    </head>
    <body>
    <textarea id="ta" rows=5 cols=40></textarea>
    </body>
    </html>
    Mark Szlazak, Mar 30, 2005
    #2
    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. Replies:
    0
    Views:
    5,854
  2. Replies:
    0
    Views:
    673
  3. Simon Wigzell

    window.onscroll and firefox

    Simon Wigzell, Sep 1, 2005, in forum: Javascript
    Replies:
    4
    Views:
    271
    GĂ©rard Talbot
    Sep 2, 2005
  4. Simon Wigzell

    Firefox onscroll

    Simon Wigzell, Sep 27, 2005, in forum: Javascript
    Replies:
    1
    Views:
    100
    Stephen Chalmers
    Sep 28, 2005
  5. Jeremy

    Firefox, textarea and onscroll

    Jeremy, Jul 6, 2006, in forum: Javascript
    Replies:
    1
    Views:
    92
    Martin Honnen
    Jul 6, 2006
Loading...

Share This Page