简体   繁体   中英

How to set automatic focus to Java applet on js

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?

  • 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM