Neil Cherry wrote:
I've seen references to using <applets ... > and document.applets to
access public Java functions from Javascript. Do I still use
document.applets with <object ...>?
Good question but hard to answer, I think that will depend on the
browser and even with a particular browser I am not sure that it could
not depend on the way you use object, whether you use
<object type="application/x-java-applet"
and/or
<object code="java:SomeApplet.class"
or the IE/Win
<object classid="
I think if you use the <object> element to embed your Java applet then a
safe way should be to give it an id attribute and then use
var applet;
if (document.getElementById && (applet =
document.getElementById('objectId')) && typeof applet.methodName !=
'undefined') {
applet.methodName();
}
to call a method if available. That doesn't depend on the browser making
an applet available in document.applets but is supported from IE 5+,
Netscape 6+, Mozilla, Opera 6+.
--
Martin Honnen
http://JavaScript.FAQTs.com/