How to connect Java applet, Javascript and HTML form

That's easy. Every applet has a name, and this name is a property of a current document. Every public method and property of applet is still public method or property of it in Javascript. So for public method put() just use document.tstapp.put(whatever-parameters-are). About connecting Javascript and HTML form see "How to connect Javascript and HTML form". And here is an example:


Type anything in box 1 and press button. It will pass this value to the applet (gray filed) and after that get it from the applet to the field 2:


And here is the code to implement this:

<script language="JavaScript"><!-- function pass() { document.tstapp.put(document.a.in0.value); document.a.out0.value = document.tstapp.get(); } //--> </script> <APPLET name=tstapp code=TestApp.class WIDTH=100 HEIGHT=30> </APPLET> <form name=a action="x.htm"> <input type=text name=in0> <input type=text name=out0> <input type=button value="Try" onClick="pass();"> </form> For Java code, click here.