2

I made an applet. It's starting when web page is loaded. But applet lost focus, when web page lost focus too and need to click on area of applet and then it gained focus. I'm tried variants but it's not helpful

document.getElementById(appletId).focus();
document.getElementById(appletId).requestFocus();

How to set focus to applet in java script?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Alexandr
  • 127
  • 1
  • 1
  • 13

1 Answers1

1
  • Ensure the applet element in the HTML declares scriptable=true
  • Add a public method to the applet that calls requestFocusInWindow().
  • Call that method using JavaScript.
  • Be sure to have the JS console open for run time debugging.
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433