Hello,
i have following problem. I generate dynamicly cells in table
and try to attach onmouseover and onmouseout events.
Code looks like this:
var suggest = $(‘t_suggest’);
for(i=0; i<items.length; i++){
var row = suggest.insertRow(-1);
var cell = row.insertCell(-1);
cell.innerHTML = items[i];
var f = function(){ cell.style.backgroundColor = ‘blue’; }
cell.addEventListener(‘mouseover’, f, false);
}
the code “works” but instead of particular cell always
the color of the last cell is being changed ?
Any ideas ?
I tried cell.onmouse…. the same effect, i event
tried to create tr’s and td’s and then appendChild
instead of insertRow and Cell, but still the same effect.
Im relative new to JavaScript so i can maybe “miss”
something.
Thanks for help,
Kuba