I generated a large HTML table of square cells with random colors using PHP.
Now I want the colors to change randomly when the user mouses over the cell, but I'm trying to prevent the new random color to be the same as the old random color.
Here's how I have it set up...
When I call randomColor() from OnMouseOver, is there any easy way to pass it the current cell color? I know that if I use color GIF's, I can easily do mouseOver's, but I'd like to stick to this method for now. Thanks.
Now I want the colors to change randomly when the user mouses over the cell, but I'm trying to prevent the new random color to be the same as the old random color.
Here's how I have it set up...
<script type="text/javascript">
var varColors = new Array(5);
varColors[0]="#FF9900";
varColors[1]="#FFFF00";
varColors[2]="#00FFFF";
varColors[3]="#FF0033";
varColors[4]="#FF00FF";
function randomColor(var currentColor)
{
do
{
var ran_number=Math.round(Math.random()*4);
color = varColors[ran_number];
}while (color == currentColor);
return(color);
}
</script>
When I call randomColor() from OnMouseOver, is there any easy way to pass it the current cell color? I know that if I use color GIF's, I can easily do mouseOver's, but I'd like to stick to this method for now. Thanks.