How do I register JavaScript callbacks in a java applet?

I'm developing an invisible Java applet that will be completely controlled by JavaScript

I can easily call the Java method of applet by using Netscape javascript. JSObject. getWindow(this). Call () calls JavaScript methods from within the applet

But in order to register JavaScript callbacks in the applet, I think I need some JavaScript function objects

I want to do:

public void registerCallback( SomeJavascriptFunction func ) { ... }

I can call from Javascript.

myapplet.registerCallback(function(){ alert("called back"); });

So I can call this function in the following code:

func.call( ... );

Does such a thing exist? What shall I do?

Right now I'm thinking about creating some JavaScript to handle this callback mechanism, not from the applet

Solution

I'm a brand new Java > I plan to explore JavaScript communication this week Here's a good chance

The above is collected by programming house for you. How to register JavaScript callbacks in Java applets? I hope this article can help you solve how to register JavaScript callbacks in Java applets? Program development problems encountered.

If you think the content of the programming home website is good, you are welcome to recommend the programming home website to programmers and friends.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>