Results 1 to 3 of 3

Thread: Alternating Row colors not returning after onmouse over

  1. #1
    Join Date
    Oct 2008
    Posts
    15
    Thanks
    4
    Thanked 1 Time in 1 Post

    Default Alternating Row colors not returning after onmouse over

    I have tabular data with alternating row colors, and a onmouseover highlight on the rows. Unfortunately, after the onmouseover works the background color of the row returns to white instead of what is defined in the css.

    Any ideas?

    PHP Code:
      <tr  class="<?php echo $cn;?>" onmouseover="this.style.background='beige';this.style.cursor='hand'"
           onclick="parent.location='edittable.php?product=<?php echo $row_Recordset1['no']; ?>'">
    Thanks,
    Robert

  2. #2
    Join Date
    Nov 2007
    Location
    USA
    Posts
    170
    Thanks
    8
    Thanked 22 Times in 22 Posts

    Default

    did you try to define the style in an onmouseout?
    What is obvious to you might not be to another.


    My Site

  3. #3
    Join Date
    Oct 2008
    Posts
    15
    Thanks
    4
    Thanked 1 Time in 1 Post

    Talking

    Thanks for the response.

    This was the fix:
    In my mySQL query I alternate the value of $cn from odd to even until it's finished.

    My CSS has corresponding styles.


    CSS
    PHP Code:
    tr.odd {
        
    font-familyVerdanaArialHelveticasans-serif;
        
    font-size14px;
        
    background-color#E0ECFF;
        
    border-top-stylenone;
        
    border-right-stylenone;
        
    border-bottom-stylenone;
        
    border-left-stylenone;
    }

    tr.even {
        
    font-familyVerdanaArialHelveticasans-serif;
        
    font-size14px;
        
    background-color#BDD0FF;
        
    border-top-stylenone;
        
    border-right-stylenone;
        
    border-bottom-stylenone;
        
    border-left-stylenone;
    }

    .
    initial {
        
    background-color#DDDDDD; color:#000000
    }

    .
    normalodd {
        
    background-color#E0ECFF
    }

    .
    normaleven 
        
    background-color#BDD0FF
        
    }

    .
    highlight {
        
    background-color#C1FFC4;


    PHP Code:
       <tr  class="<?php echo $cn;?>" onMouseOver="this.className='highlight'";"this.style.cursor='pointer'" 
    onMouseOut="this.className='normal<?php echo $cn;?>'"  onclick="parent.location='edittable.php?product=<?php echo $row_Recordset1['no']; ?>'" >      
          <td><?php echo $row_Recordset1['product']; ?></td>
          <td><?php echo $row_Recordset1['description']; ?></td>
          <td><?php echo $row_Recordset1['department']; ?></td>
          <td><?php echo $row_Recordset1['price']; ?></td>
        </tr>
        
        <?php
            
    if ($cn == "odd") {
            
    $cn "even";}
        else {
            
    $cn "odd";
        } 
         } while (
    $row_Recordset1 mysql_fetch_assoc($Recordset1)); ?>

Bookmarks

Posting Permissions

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