Adding onmouseover to table rows through DOM (javascript)?

Hello guys.

I have the following problem:

I’ve generated a table through javascript using the appendChild method, and added at the same time unique row, column and cell IDs so I can easily fetch them later.

I’m trying to add (through a different loop) alternating row colors (easily done, it’s not the annoying bit) which change when onmouseover’ed .

Here’s my code (which doesn’t work)

for(a=0;a<=20;a+=1){
		//m = (a % 2)*10;
		curRow = document.getElementById('rowRow'+a);
		curRow.onmouseover = function(){curRow.style.backgroundColor='rgb('+a*10+','+a*10+','+a*10+')'};
		curRow.onmouseout = function(){curRow.style.backgroundColor='#fefefe'};
		
}

Can you see what I’m doing wrong ?

Cheers

mlk

edit: I’ve posted a more complete explanation on http://www.webdeveloper.com/forum/showthread.php?p=923013#post923013 I’ll post the answer here if they answer faster. I’m still trying to figure it out.