-
change element
I have a bunch of table rows and I want to change the color of the rows on a mouse over and change it back on the onmouseout... I have that much working. Now I have a function which, when you click on a row, it sets the color of a row to a different color. Problem is, because of the mouseout, it changes it back to the original color as soon as I move away again.
I wrote this:
Code:
function checkchange(el)
{
var dael = document.getElementById(el);
alert(dael);
/*if(dael.style.bgColor != 'white');
dael.style.bgColor = '#DDDDDD');*/
}
But I can't seem to get it to work. I'm sending the id of the row in the onmouseout call. What am I doing wrong?
Tell me if you need to see more of the code.
-
You should set a flag.
Pseudo code:
Code:
var cell[x][y] = 0;
if clicked {
cell[x][y]=1
}
function onmouseout() {
if cell[x][y]!=1 {
(set original cell color)
}
}
..kinda thing. Know what I mean?
Phreak
-
I usually do
(In the mouseover):
Code:
dael.oldclr = dael.style.backgroundColor;
dael.style.backgroundColor = highClr;
(In the mouseout):
Code:
dael.style.backgroundColor = dael.oldclr;