What is the mouse?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Csaba2000

    #1

    What is the mouse?

    I'm probably just blanking today, but, how can I find
    out what type the cursor currently is? Is
    document.active Element.style.c ursor the way to go on this?
    But that's only for IE, right?

    Thanks for any tips on this,
    Csaba Gabor from New York


  • Lasse Reichstein Nielsen

    #2
    Re: What is the mouse?

    "Csaba2000" <news@CsabaGabo r.com> writes:
    [color=blue]
    > I'm probably just blanking today, but, how can I find
    > out what type the cursor currently is?[/color]

    It's hard.
    [color=blue]
    > Is document.active Element.style.c ursor the way to go on this?[/color]

    Not the "style" element, but "currentSty le" in IE will give the
    current style of the object. "activeElem ent"
    [color=blue]
    > But that's only for IE, right?[/color]

    Right. Same for "activeElement" . The standard-based method should
    work in Mozilla and Opera 7.2, so if we combine the two, we get:

    function getCurrentStyle (elem,prop) {
    if (elem.currentSt yle) {
    return elem.currentSty le[prop];
    } else {
    var cstyle = document.defaul tView.getComput edStyle(elem,nu ll);
    return cstyle[prop];
    }
    }

    If you can then find the element that the mouse points to (probably inside
    a mouse event handler), then you can use the above to find the cursor:

    var cursor = getCurrentStyle (elem,"cursor") ;

    What you can use it for is another question. Mozilla and IE reported "auto",
    while Opera 7.2 said "default". Neither Mozilla nor IE changed their opinion
    just because I hoovered over an element with a ":hover{cursor: text}" rule.
    They both said "auto" anyway. Opera 7.2 did say "text".

    Good luck.
    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    Working...