You can use netscape.javascript.* package to implement your idea. This is the example:package test ; import netscape.javascript.*; import java.applet.*;public class AApplet extends Applet{
public String doFoo( String name ){ return "******"+name+"****" ; } } in html file,you can :<html> <head> <title>test</title> <script language="javascript"> <!-- function foo(){ var rt = document.aApplet.doFoo("Jan") ; alert( rt ) ; } --> </script> </head> <body><OBJECT id="aApplet" classid = "...." codebase = "..." WIDTH = 0 HEIGHT = 0 > <PARAM NAME = "java_code" value = "test.AApplet" > <PARAM NAME = "java_codebase" value = ......."> <PARAM NAME = "type" value = "........."> <PARAM NAME = "cache_archive" value = ".........."> <PARAM NAME = "cache_option" value = "........"> <PARAM NAME = "cabinets" value = "........."> <PARAM NAME = "MAYSCRIPT" value = "true"> </OBJECT></body> </html>
This is the example:package test ;
import netscape.javascript.*;
import java.applet.*;public class AApplet extends Applet{
public String doFoo( String name ){
return "******"+name+"****" ;
}
}
in html file,you can :<html>
<head>
<title>test</title>
<script language="javascript">
<!--
function foo(){
var rt = document.aApplet.doFoo("Jan") ;
alert( rt ) ;
}
-->
</script>
</head>
<body><OBJECT id="aApplet"
classid = "...."
codebase = "..."
WIDTH = 0 HEIGHT = 0 >
<PARAM NAME = "java_code" value = "test.AApplet" >
<PARAM NAME = "java_codebase" value = .......">
<PARAM NAME = "type" value = ".........">
<PARAM NAME = "cache_archive" value = "..........">
<PARAM NAME = "cache_option" value = "........">
<PARAM NAME = "cabinets" value = ".........">
<PARAM NAME = "MAYSCRIPT" value = "true">
</OBJECT></body>
</html>