Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > instanceof, HTMLSelectElement and Greasemonkey

Reply
Thread Tools

instanceof, HTMLSelectElement and Greasemonkey

 
 
Robert Kühne
Guest
Posts: n/a
 
      04-22-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
greasemonkey and onclick Matej Javascript 3 03-02-2006 08:18 PM
Dynamically set value in htmlselectelement via DOM? kevinold@gmail.com Javascript 1 02-09-2006 03:17 PM
greasemonkey and trademe no NZ Computing 1 09-27-2005 06:25 AM
Fix broken pages (eg: beta-groups) with greasemonkey or related css/XPI? SpamCan Firefox 1 06-01-2005 07:24 AM
extend/sub-class HTMLSelectElement Bill M. Javascript 5 11-13-2003 12:13 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57