A Java applet is a small program written
in
the Java program language.
Browsers can allocate part of their window space to display the Java applet.
Both the older
<
applet
>
and newer
<
object
>
tags are supported by browsers
for
embedding Java applets.
JavaScript programs can communicate
with
the Java applets using any
methods or properties that the applet makes
public
. You can also access
the applet through the applets array that is a built
-
in
object of the HTML
document.
<
applet name
=
"myApplet"
code
=
"theapplet.class"
codebase
=
"folder"
>
<
param name
=
"parm1"
value
=
"value1"
>
<
param name
=
"parm2"
value
=
"value2"
>
<
param name
=
"parm3"
value
=
"value3"
>
</
applet
>
The
<
applet
>
tag attributes are
:
-
name name that JavaScript can use to communicate
with
the applet
-
code applet filename
-
codebase folder where applet file is located (not needed
if
in
same folder as HTML file
The
<
param
>
tags are simply name
/
value pairs that are passed to the Java
applet. Use as many (or none) as required by the specific Java applet.
If a Java applet named
'MyApplet'
had a
public
method called
'myFunction'
,
it can be accessed
with
this
code
: