Entry
How can I access public members of an applet from JavaScript?
How to call a JApplet method from within JavaScript using <Object> with IE5 browser? Please show ex
Apr 9th, 2008 20:38
ha mo, Martin Honnen, Constants,
In NN3+ and IE4+ APPLET elements are reflected into js as elements of
the
document.applets
array and as properties of the document object if they are named, i.e.
an
<APPLET NAME="anApplet" ...>...</APPLET>
is scriptable as
document.anApplet
and
document.applets[appletIndexInSouce]
Then you can access public members with the usual dot or bracket
notation for properties/methods:
document.anApplet.publicProperty
document.anApplet.publicMethod()
or
document.anApplet['publicProperty']
document.anApplet['publicMethod']()
where the last notation is important for member names like delete which
are keywors in js for instance the java.io.File class has a delete
method you would need to call as
fileObj['delete']()
Details about parameter passing/type conversion between JavaScript and
Java when calling into an applet are explained in the liveconnect
section of the client side JavaScript guide on developer.netscape.com.
If you use sun's java plugin (so an EMBED tag in NN4 and an OBJECT tag
in IE) you can with IE call
document.all.objectID.methodName()
NN4 with the java plugin DOES NOT ALLOW JavaScript to call the EMBEDded
applet's methods.
http://www.businessian.com
http://www.healthinhealth.com
http://www.computerstan.com
http://www.financestan.com
http://www.healthstan.com
http://www.internetstan.com
http://www.moneyenews.com
http://www.technologystan.com
http://www.zobab.com