Here is a small snip-it that I'm using to colour lines of a table as a user rolls over them.
var rows = document.getElementsByTagName("tr");
var defaultColor = rows[i].style.backgroundColor;
rows[i].onmouseover = change;
rows[i].onmouseout = function()
My problem arises on the onmouseout event. Instead of calling an unnamed function, I would rather call a named function outside of 'colour'. However, I'm having much trouble passing arguments and don't know how to do this - or whether I can at all.
I would like the code to look something like this:
rows[i].onmouseout = changeBack(defaultColor);
But I know that this would initiate 'changeBack' right then and there, and it wouldn't have access to defaultColor.
How do I get around this?