如何操作Java小程序网页的DOM

发布于 2024-12-25 20:12:51 字数 404 浏览 2 评论 0原文

我想修改小程序中隐藏 标记的值。但我不知道如何操作 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

苍风燃霜 2025-01-01 20:12:51

最好将 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文