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 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Posts
    144
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Question Colour changes in a table

    Hi Guys,

    I have a desire to know how to change the background colour of rows in a table with a mouse over event and when a link in a row is clicked the background to change to a 3rd colour?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Montreal, Canada
    Posts
    644
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Code:
    <table border="1" width="100%">
      <tr>
        <td width="50%">&nbsp;</td>
        <td width="50%">&nbsp;</td>
      </tr>
      <tr onmouseover="if (!this.getAttribute('tmp')) {this.style.backgroundColor='red';};" onmouseout="if (!this.getAttribute('tmp')) {this.style.backgroundColor='';};" onclick="if (event.srcElement.tagName.toLowerCase()=='a') {this.style.backgroundColor='blue'; this.setAttribute('tmp',true);};">
        <td width="50%"><a href="javascript:;">site</a></td>
        <td width="50%">&nbsp;</td>
      </tr>
      <tr>
        <td width="50%">&nbsp;</td>
        <td width="50%">&nbsp;</td>
      </tr>
    </table>

  • #3
    Regular Coder
    Join Date
    Oct 2002
    Posts
    144
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Colour changes in a table

    x_goose_x thanks for your assistance. I recon that I ca now modify your script to meet my needs.

    Thanks again


  •  

    Posting Permissions

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