instanceof, HTMLSelectElement and Greasemonkey

Discussion in 'Javascript' started by Robert Kühne, Apr 22, 2007.

  1. Hi!

    I have a small problem with instanceof. Since im new to javascript I
    can't figure this one out myself.
    I have a private function which is registered to be called on mouseover
    on some <select> elements. It gets called but unfortunately also when
    the mouse is hovering over the opened menu over the <option> elements.
    So it gets called for several targets. To catch this I wanted to check
    on the type with instanceof. But that does not work at all.

    The first if is not working while the second if serves as workaround at
    the moment. I do not like that solution though.

    var touchy = function(e) {
    if (e.target instanceof HTMLSelectElement) {
    GM_log("Yes");
    }

    if (e.target.tagName.toUpperCase() == 'SELECT') {
    e.target.value = someNewValue;
    }
    };

    As you may have noticed it is a Greasemonkey script. Now, I have some
    suspects to blame: Greasemonkey hiding somehow something or maybe
    Firefox (which I am using) for something I don't know.

    Any ideas what I'm doing wrong?

    Robert Kühne
     
    Robert Kühne, Apr 22, 2007
    #1
    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:
    21
    Views:
    22,037
  2. Adrian Holovaty

    ANN: Greasemonkey compiler

    Adrian Holovaty, Apr 27, 2005, in forum: Python
    Replies:
    0
    Views:
    376
    Adrian Holovaty
    Apr 27, 2005
  3. Bill M.

    extend/sub-class HTMLSelectElement

    Bill M., Nov 4, 2003, in forum: Javascript
    Replies:
    5
    Views:
    232
    Bill M.
    Nov 13, 2003
  4. Replies:
    1
    Views:
    129
  5. Matej

    greasemonkey and onclick

    Matej, Mar 2, 2006, in forum: Javascript
    Replies:
    3
    Views:
    137
    Matej
    Mar 2, 2006
Loading...

Share This Page