最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Calling Javascript functions from a Java Applet - Stack Overflow

programmeradmin0浏览0评论

I have a Java Applet in a HTML page. I need to have the applet call a certain Javascript function to notify the HTML page of certain events.

The way I call the JavaScript function currently is:

getAppletContext().showDocument(new URL("javascript:window.notifyEvent("+msisdn+")"));

I define the actual function within the HTML code but when the applet actually calls it I get the Uncaught ReferenceError: notifyEvent is not defined error.

Where do I need to define the javascript function for the applet to be able to call it?

Thanks!

I have a Java Applet in a HTML page. I need to have the applet call a certain Javascript function to notify the HTML page of certain events.

The way I call the JavaScript function currently is:

getAppletContext().showDocument(new URL("javascript:window.notifyEvent("+msisdn+")"));

I define the actual function within the HTML code but when the applet actually calls it I get the Uncaught ReferenceError: notifyEvent is not defined error.

Where do I need to define the javascript function for the applet to be able to call it?

Thanks!

Share Improve this question asked Mar 13, 2012 at 12:42 BenBen 10.3k21 gold badges103 silver badges158 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 3

To do this, you must use JSObject. It's been around for a long time, although I hear there can be differences between browsers still. So if you need to support many browsers I'd suggest checking across your supported set once you see it work in one.

Bridge between the Java applet and the text input controls on the web page

You can give this a try http://docs.oracle./javase/tutorial/deployment/applet/invokingJavaScriptFromApplet.html

发布评论

评论列表(0)

  1. 暂无评论