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 7 of 7
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post

    tr onmouseover class change

    I have this code

    <tr onmouseover="this.className='foo'">

    but it doesnt do anything!!!!!

    any ideas?!

  • #2
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    further more, when a class is associated with a <TD>, I cannot change it!?

    here's the HTML

    <tr onmouseover="this.className='foo'">
    <td class="columnone">&nbsp;</td>
    <td class="columntwo">&nbsp;</td>
    </tr>

    and the CSS

    .foo { background-color:red; }
    .columnone { background-color:#CCCCCC; }
    .columntwo { background-color:#BBBBBB; }

    so basically because the TDs have been assigned a class - when I say to the mouseover, it doesnt do anything. If I actually remove the classes from the <TD>'s - it works..... how can I do this?!

  • #3
    Regular Coder
    Join Date
    Jun 2004
    Location
    underground
    Posts
    186
    Thanks
    0
    Thanked 0 Times in 0 Posts

    What's the problem?

    If you don't want the tr class to be overridden by the td classes, don't assign td classes, or remove them.

    - onmouseover="classStuff(this)" -

    function classStuff(blah)
    {
    // set blah.className...
    var tds = blah.getElementsByTagName("TD");
    // loop tds, change classNames to ""...
    }

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    Nashua, NH
    Posts
    1,724
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Vladdy | KL
    "Working web site is not the one that looks the same on common graphical browsers running on desktop computers, but the one that adequately delivers information regardless of device accessing it"

  • #5
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    cheers for the help guys...

    Quote Originally Posted by neofibril
    If you don't want the tr class to be overridden by the td classes, don't assign td classes, or remove them.
    I need to assign the TD classes in the first instance to apply their own formatting.... might have to look for another way around it....

    Vladdy - cheers for that link - seems to do what I want - so will give it a go...!

    thanks again guys

  • #6
    Regular Coder
    Join Date
    Jun 2004
    Location
    underground
    Posts
    186
    Thanks
    0
    Thanked 0 Times in 0 Posts
    homerUK,
    My apologies for the blunt reply...

  • #7
    Regular Coder
    Join Date
    Nov 2002
    Location
    Manchester, UK
    Posts
    533
    Thanks
    4
    Thanked 1 Time in 1 Post
    Quote Originally Posted by neofibril
    homerUK,
    My apologies for the blunt reply...
    hey, no worries!!!! no need to apologise!!


  •  

    Posting Permissions

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