0

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.which ? 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.

Varun
  • 5,001
  • 12
  • 54
  • 85

1 Answers1

0

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;

Community
  • 1
  • 1
jmj
  • 237,923
  • 42
  • 401
  • 438