Javascript onMouse...NotOver?

Discussion in 'Web Design and Development' started by Macman1993, Mar 19, 2010.

  1. Macman1993 macrumors 6502

    Macman1993

    Joined:
    Nov 23, 2007
    #1
    Quick question, in JavaScript I know I can use OnMouseOver for mouse over events but is there the equivalent for not over?
     
  2. Darth.Titan macrumors 68030

    Darth.Titan

    Joined:
    Oct 31, 2007
    Location:
    Austin, TX
  3. Dunmail macrumors regular

    Joined:
    Mar 27, 2009
    Location:
    Skipton, UK
    #3
    As indicated, onmouseout is the opposite of onmouseover (note the capitalisation). However if this is for doing things like rollover effects on buttons then the CSS :hover pseudoclass may be preferable.

    This is a somewhat grey area - you can do it via either method and the advocates of each would recommend their way - but it all depends on just what you want to happen when the mouse is moved on and off the element.

    The big downside to the CSS method is that IE6 doesn't support :hover on anything but <a> elements - IE7 will only do so if your DOCTYPE is strict rather than transitional. The downside to Javascript is that the effect disappears if Javascript is turned off.
     
  4. Macman1993 thread starter macrumors 6502

    Macman1993

    Joined:
    Nov 23, 2007
    #4
    Great thanks guys, and out of curiosity what the hell was going through Microsoft's head when they made ie6? It seems like half the things around don't work with it and tons of server software I've used has to include ie6 fixes.
     
  5. END3R macrumors member

    END3R

    Joined:
    Jan 27, 2009
    #5
    This has been common knowledge for 9 years.
     

Share This Page