Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Sep 2007
    Location
    London
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Simple TR background change

    Hello, I'm currently using this script to highlight the text within a whole row of a table on mouseOver.

    What I'd like to do is change it so that the background color changes. I've tried 'this.style.backgroundcolor = "#e00000" ' but with no success.

    Any help or tutorial suggestion would be a great help.

    Many thanks
    function highlightRows() {
    if (!document.getElementsByTagName) return false;
    var rows = document.getElementsByTagName("tr");
    for (var i=0; i<rows.length; i++) {
    rows[i].onmouseover = function() {
    this.style.color = "#e00000";
    }
    rows[i].onmouseout = function() {
    this.style.color = "#000000";
    }
    }
    }
    addLoadEvent(highlightRows);

  • #2
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Picky javascript.

    this.style.backgroundColor

    Camel-case it.


  •  

    Posting Permissions

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