JavaScript Lab


This Lab illustrates some simple communication between JavaScript and IFC based Java. You can type JavaScript commands in the TextField within the Java applet. Pressing enter there will cause the JavaScript command to be executed. The simplest example would be to type:

alert('Hello World')

and press enter. The 'Copy Log' button will copy the contents of the IFC TextView into the HTML textarea. It illustrates a method of pushing data from the Java applet back to the HTML page.

The JavaScript buttons call methods on the IFC Java applet to show you the previous or next commands in the command history. Entering a new command in the JavaScript TextField and clicking the 'Insert Command' button will push the text from the HTML page into the Java applet. Clicking in the Java TextField and pressing enter will execute the command.

Note: Because this uses JavaScript, this example cannot be run in Sun's AppletViewer. It must be run from a JavaScript enabled browser, such as Navigator.

Build Notes