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 4 of 4

Thread: Cell Changes

  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    271
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Cell Changes

    Is there a script to change the color of the cells on mouse in and out AND also the color of the text also the same way


    Thxs Steve

    Newbie at CSS

  • #2
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Well yes. You could do it in multiple ways. One of which is by changing the class of the cell on mouse over and mouse out.

    Code:
    <style>
    <!---
    .cellNormal {
    background-color:#ff0000;
    color:#000000;
    }
    
    .cellHover {
    background-color:#000000;
    color:#ff0000;
    }
    --->
    </style>
    <script language="javascript" type="text/javascript">
    function Rollover(TheCell){
    TheCell.className = 'cellHover'
    }
    function Rollout(TheCell){
    TheCell.className = 'cellNormal'
    }
    </script>
    <table>
     <tr>
       <td id="cell1" onMouseOver="Rollover(cell1)" onMouseOut="Rollout(cell1)">Cell1</td>
       <td id="cell2" onMouseOver="Rollover(cell2)" onMouseOut="Rollout(cell2)">Cell2</td>
     </tr>
     <tr>
       <td id="cell3" onMouseOver="Rollover(cell3)" onMouseOut="Rollout(cell3)">Cell3</td>
       <td id="cell4" onMouseOver="Rollover(cell4)" onMouseOut="Rollout(cell4)">Cell4</td>
     </tr>
    </table>
    All you do is specify the class names for the roll over and roll out events in their respective javascript functions. Make sure when you are using the onMouse events that you have the correct id.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    United Kingdom Confused: Often
    Posts
    859
    Thanks
    0
    Thanked 0 Times in 0 Posts
    good to see you making use of className... lol

    heres a related thread:

    http://www.codingforums.com/showthre...threadid=11927
    redhead

  • #4
    Senior Coder Mhtml's Avatar
    Join Date
    Jun 2002
    Location
    Sydney, Australia
    Posts
    3,531
    Thanks
    0
    Thanked 1 Time in 1 Post
    Thanks to you


  •  

    Posting Permissions

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