SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Check onmouseover on element?

    Hello all,
    I'm looking for a simple if/else statement that checks if an element has been moused over...something like:
    Code:
    if (document.getElementById('navitem').onmouseover == true) {
         //DO THIS
    }
    I've been trying something like it...
    Code:
    var thingy = document.getElementById("navitem");
    thingy.onmouseover = function {
    	alert('yes');
    };
    with no results. Any advice?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,729
    Mentioned
    104 Post(s)
    Tagged
    4 Thread(s)
    The function needs the formal parameters

    Change function { to function() {


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •