我在标题中有一个事件监听器:
window.onkeydown = function(e) {
var key = e.keyCode ? e.keyCode : e.which;
if(key == 27) {
var panel = document.getElementById('largeImgPanel');
hideMe(panel);
}
if(key == 39) {
arrow_right.onclick = onRight; //Wrong
}
};
下我有一个功能:
window.onload = function() {
...
var onRight = function showNext(img_thumb) {
index = index + 1;
document.getElementById('largeImg').src = arr_big[index].src;
showLargeImagePanel();
unselectAll();
};
arrow_right.onclick = onRight;
我的问题是:如何从事件侦听器“执行” onRight 变量?