så simplet er det:
import netscape.javascript.*;
import java.applet.*;
import java.awt.*;
class MyApplet extends Applet {
public void init() {
JSObject win = JSObject.getWindow(this);
JSObject doc = (JSObject) win.getMember(\"document\");
JSObject loc = (JSObject) doc.getMember(\"location\");
String s = (String) loc.getMember(\"href\"); // document.location.href
win.call(\"f\", null); // Call f() in HTML page
}
}
og så skal dit applet tag se sådan her ud:
<OBJECT classid=\"clsid:8AD9C840-044E-11D1-B3E9-00805F499D93\"
width=\"200\" height=\"200\" align=\"baseline\"
codebase=\"
http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0\">
<PARAM NAME=\"code\" VALUE=\"XYZApp.class\">
<PARAM NAME=\"codebase\" VALUE=\"html/\">
<PARAM NAME=\"type\" VALUE=\"application/x-java-applet;version=1.3\">
<PARAM NAME=\"MAYSCRIPT\" VALUE=\"true\">
<PARAM NAME=\"model\" VALUE=\"models/HyaluronicAcid.xyz\">
No JDK 1.3 support for APPLET!!
</OBJECT>
se her:
http://java.sun.com/products/plugin/1.3/docs/jsobject.htmlhttp://www.eksperten.dk/spm/31076Men det kræver jo at brugeren downloader dette plugin!
Kan du ikek kalde den anden vej? Altså fra javscript til JAVA, da det sagtens kan lade sig gøre?