HI
i have an applet included in my html page. The applet consist of a button
Button play
i want this button to be triggered on click of a enter key, i mean it to be clicked every time i hit enter
i tried
if (document.layers)
document.captureEvents(Event.KEYDOWN);
document.onkeydown = function (evt)
{ var keyCode = evt ? (evt.whi开发者_如何学Pythonch ? evt.which : evt.keyCode) : event.keyCode;
alert(keyCode);
if (keyCode == 13) {
document.playAndRecordAll.stopRecording();
alert("hello");
return false;
}
else return true; };
but its not working, is there any thing internal in applet to do so?
Note: i found that if the focus is on the applet button then hitting space clicks it.
From here, You can detect Enter press on a page,
$("#id_of_textbox").keyup(function(event){
if(event.keyCode == 13){
//enter pressed
}
});
Now, you need to create JSObject
and need to access Button from Applet from javascript and simulate its click event;
精彩评论