PDA

Click to See Complete Forum and Search --> : change element


ober0330
May 26th, 2004, 01:16 PM
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: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.

chemicalNova
May 26th, 2004, 11:46 PM
You should set a flag.
Pseudo 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

CornedBee
May 27th, 2004, 02:29 AM
I usually do
(In the mouseover):
dael.oldclr = dael.style.backgroundColor;
dael.style.backgroundColor = highClr;
(In the mouseout):
dael.style.backgroundColor = dael.oldclr;