从 JS 调用 applet id 时Object doesn't support this property or method
出现错误。
请检查代码...
<!--[if !IE]> Firefox and others will use outer object -->
<object
classid = "java:com.mypack.myclass.ABCClass.class"
type = "application/x-java-applet"
height = "200"
width = "480"
id = "myappletId">
<!-- Konqueror browser needs the following param -->
<param name="cache_archive" value="a.jar, b.jar, c.jar" />
<param name="codebase" value="applets/" />
<param name="OnMouseLeftClickJS" value="showModal()">
<!--<![endif]-->
<!-- MSIE (Microsoft Internet Explorer) will use inner object -->
<object
classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
codebase = "http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab"
height = "200"
width = "480"
id = "myappletId">
<param name="code" value="com.mypack.myclass.ABCClass" />
<param name="cache_archive" value="a.jar, b.jar, c.jar" />
<param name="OnMouseLeftClickJS" value="showModal()">
<param name="codebase" value="applets/" />
<strong>No Java Support</strong>
</object>
<!--[if !IE]> close outer object -->
</object>
<!--<![endif]-->
现在,在我的 showModal() js 函数中,
var myId = document.getElementById("myappletId"); //At this point I am getting the object data.
我在我的模态窗口中执行一些操作,这是一个 jquery 模态窗口,我有一个按钮。当我点击它时,我正在调用一个函数,比如 xyz()。
function xyz() {
var myId = document.getElementById("myappletId");
//At this point myId is getting empty.
}
这仅在 IE 浏览器中发生。我在IE8中测试过。在 Firefox 和 chrome 中运行良好。
我没有浏览我的页面,在查看源代码时我可以看到我的对象标签。
请帮帮我。
提前致谢...