嗨
我的html页面中包含了一个applet。小程序由一个按钮组成
Button play我希望这个按钮在点击enter键时被触发,我的意思是每次我点击enter时都会点击它
我试过了
if (document.layers)
document.captureEvents(Event.KEYDOWN);
document.onkeydown = function (evt)
{ var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : event.keyCode;
alert(keyCode);
if (keyCode == 13) {
document.playAndRecordAll.stopRecording();
alert("hello");
return false;
}
else return true; };但是它不能工作,在applet内部有什么东西可以这样做吗?
注意:我发现如果焦点在applet按钮上,那么按空格键就会单击它。
https://stackoverflow.com/questions/4918628
复制相似问题