Dynamically Change onmouseOver event

Discussion in 'JavaScript' started by johnpnoble, Nov 24, 2006.

  1. #1
    I am trying to change the onmouseOver event dynamically.

    Here's what I have:

    document.getElementById('accomodationcell').onmouseOver = function(){this.className = 'submenuover'};

    Except its not working. Any ideas???

    John
     
    johnpnoble, Nov 24, 2006 IP
  2. vid

    vid Peon

    Messages:
    209
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think problem is in ID, try to past ID as a number.
     
    vid, Nov 24, 2006 IP
  3. ajsa52

    ajsa52 Well-Known Member

    Messages:
    3,426
    Likes Received:
    125
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Try with CSS. Example:
    
    <html>
    <head>
    <style type="text/css">
    a#accomodationcell:hover { text-decoration: none; color: red; background-color: green; }
    </style>
    </head>
    <body>
      <a id="accomodationcell" href="www.google.com">Google</a>
    </body>
    </html>
    
    
    Code (markup):
     
    ajsa52, Nov 24, 2006 IP