Is it possible to have a Java Applet that is running on a web page to send/return a string (or an int) so that some JavaScript that is running on the same webpage can retrieve the information? If so, HOW?
Thanks!
-Bary-
This is very easy to do. The Java applet needs a public method which
returns a String and all Javascript has to do is call it. Here's The
Modern CA Author Javascript which does this in a setting with frames
where the applet may not even exist:
var mutatedRule = 'Press the "Test CA" button first'
var d = parent.frames["view"].document
var applet = d.applets[0]
if (applet) {
mutatedRule = applet.getRuleCurrentMutation()
}
Here's what the Java method looks like:
public synchronized String getRuleCurrentMutation() {
return RuleExport.toString(rule, rule.mutated != null ?
rule.mutated : rule.unmutated);
}
George Maydwell