www.webdeveloper.com
Results 1 to 3 of 3

Thread: onMouseOver and onMouseOut ??

  1. #1
    Join Date
    May 2010
    Posts
    35

    onMouseOver and onMouseOut ??

    Can anyone tell me why this is not working?

    Code:
    workingTR = workingTable.insertRow(position+i);
    workingTR.onMouseOver = 'this.bgColor=\'#C0C0C0\';';
    workingTR.onMouseOut = 'this.bgColor=\'#FFFFFF\';';
    It shows in the Dom Explorer that these attributes are being set, however the
    the color is not changing when I move my mouse over the row.

    Any help is appreciated,
    Thanks
    Last edited by objNoob; 06-17-2010 at 09:26 AM.

  2. #2
    Join Date
    May 2010
    Posts
    35

    Thumbs up

    For anyone interested, here is the solution:

    Code:
    workingTR = workingTable.insertRow(position+i);
    workingTR.onmouseover = function () { this.bgColor = '#DDDDDD'; };
    workingTR.onmouseout = function () { this.bgColor = '#FFFFFF'; };
    Thanks for the inspiration!

    Edit: I was researching this and it appears I should be using addEventListener to adhere with DOM 2. However, I feel I will stick with my current solution to allow other versions of MSIE.
    Last edited by objNoob; 06-17-2010 at 04:35 PM.

  3. #3
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    and the up todate method
    Code:
    workingTR.onmouseover = function () { this.style.backgroundColor = '#DDDDDD'; };
    workingTR.onmouseout = function () { this.style.backgroundColor = '#FFFFFF'; };

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles