...

View Full Version : Cell Changes



stevan
12-28-2002, 08:41 PM
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:confused:

Newbie at CSS

Mhtml
12-28-2002, 09:46 PM
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.



<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.

redhead
12-28-2002, 11:13 PM
good to see you making use of className... lol

heres a related thread:

http://www.codingforums.com/showthread.php?&threadid=11927

Mhtml
12-28-2002, 11:27 PM
Thanks to you :)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum