proves connexió
javascript - java
codi font: sortida.class
|
http://www.rgagnon.com/masters/java-js.html Tot seguit, explicació extreta de http://www.rgagnon.com/javadetails/java-0183.html: JavaScript calling Java (dynamic runtime invocation) Code for JavaScript to call Java is given below. Invoking Java at runtime
like First Step: Give the applet on the Webpage a Name Using a name is preferable than referring to applet[0]. <applet code="JSTellJava.class" name="Name1" width=320 Example 1: Call a Java method To invoke a Java method called "increaseNumber" (from JavaScript), var theIncrement; Example 2: Call a Java method and retrieve return value It is the same as the last example, except the return value is obtained: str = document.Name1.getString(); Example 3: Access a Public Java Variable Although it is not good practice to directly manipulate variables in
a Java document.Name1.delay = 500;
|