Lets take this a little farther. Your show function doesn't show anything except that the onclick has reached it. Better to use this as the function:
Code:
function show(keytest, displaytest) {
alert (keytest + " and " + displaytest);
}
Now we will know that we ran show() and what variables are passed to it.
Because you are using single quotes, you do not need to escape for the variables. So the second onclick call can be:
Code:
cell2.innerHTML ="<a onclick='show(key, display)'>" + display + "</a><br>";
Easier on the eyes and the coding brain, don't you think?
If my putting ...test in there messes you up this also works:
Code:
cell2.innerHTML ="<a onclick='show(key, display)'>" + display + "</a><br>";
// call with 2 params
function show(key, display) {
alert (key + " and " + display);
}