View Full Version : 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?
<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
Moshambi
10-20-2008, 04:13 AM
did you try to define the style in an onmouseout?
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
tr.odd {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
background-color: #E0ECFF;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}
tr.even {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;
background-color: #BDD0FF;
border-top-style: none;
border-right-style: none;
border-bottom-style: none;
border-left-style: none;
}
.initial {
background-color: #DDDDDD; color:#000000
}
.normalodd {
background-color: #E0ECFF
}
.normaleven {
background-color: #BDD0FF
}
.highlight {
background-color: #C1FFC4;
}
<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)); ?>
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.