Java 到 JavaScript 的通信
我想从我的 Java 小程序中访问 HTML 元素。就像我想要执行以下操作:
- 将文本框的值传递给小程序
- 从小程序我想在 HTML 页面内设置一些文本。就像小程序从文本框中获取一些输入一样。进行处理,然后将输出打印为 HTML 页面上的
href
。
我该怎么做?
我听说过一些java库: http://java.sun.com /products/plugin/1.3/docs/jsobject.html。
但我可以从哪里下载它?
I want to access HTML elements from within my Java applet. Like I want to do following:
- Pass a value of text box to applet
- From applet I want to set some text inside an HTML page. Like applet takes some input from text box. Does processing and then print output as
href
on HTML page.
How can i do this?
I heard of some java library: http://java.sun.com/products/plugin/1.3/docs/jsobject.html.
But where can i download it from?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为这些链接会将您带到当前文档:
http://docs.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html
https://developer.mozilla.org/en/JavaScript/Guide/LiveConnect_Overview
根据这些文档,从 Java 1.4 开始,与 Javascript 通信的类包含在JRE,位于
lib/plugin.jar
中。I think those links take you to the current documentation:
http://docs.oracle.com/javase/6/docs/technotes/guides/plugin/developer_guide/java_js.html
https://developer.mozilla.org/en/JavaScript/Guide/LiveConnect_Overview
According to those documents, since Java 1.4 the classes to communicate with Javascript are inlude in the JRE, in
lib/plugin.jar
.您可以使用Rhinohide。这是一个完全符合您要求的演示 Events_2_Demo< /a>.
You can use Rhinohide. Here's a demo that does exactly what you want Events_2_Demo.