js报错 Uncaught TypeError: Cannot set property ✀onclick✀ of undefined

2025-02-27 06:19:57
推荐回答(1个)
回答1:

把获取元素放在上面,你这样写在读取这段的时候这些变量都是未定义的
video.style.display = 'block';
xp.play();
}
closex[k].onclick = function()
{
video.style.display = 'none';
xp.pause();
}
})(i)
}