如何操作Java小程序网页的DOM
我想修改小程序中隐藏 标记的值。但我不知道如何操作 DOM 元素。
我在官方Java SE教程中找到了文章“Manipulate DOM of Applet's Web Page”。但是当我尝试以下代码时: Class c = Class.forName("com.sun.java.browser.plugin2.DOM");
我收到一个 ClassNotFoundException
。
Java Common DOM API 是否随 JDK 一起安装?它只支持特殊浏览器?或者我们应该使用其他 API?
我使用 JDK 7、浏览器 Google Chrome 和 Eclipse 进行编程。
此致
I'd like to modify the value of a hidden <input>
tag in my applet. But I don't know how to manipulate DOM elements.
I've found the article "Manipulating DOM of Applet's Web Page" in official Java SE tutorial. But when I try the following code :Class c = Class.forName("com.sun.java.browser.plugin2.DOM");
I get a ClassNotFoundException
.
Is the Java Common DOM API is installed with JDK ? It only supports special browsers ? Or we should use an other API ?
I'm using JDK 7, browser Google Chrome and Eclipse for programming.
Best regards
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最好将 DOM 操作抽象为 JS,因为有些 JS API 会考虑跨浏览器差异。然后让小程序调用通用 JS 方法。
You are better off abstracting the DOM manipulation out to JS, since there are JS APIs that take cross-browser differences into account. Then have the applet call the generic JS methods.