Public variable and methods of Java Applet are visible to a HTML document. So using JavaScript you can access the public variables and public functions.

The syntax is:

 var some_var = document.appletname.variable_name

With this you will get the value of the variable variable_name in your JavaScript variable some_var.