T
Tormod Omholt-Jensen
I need to dynamically insert the following applet code in my document:
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 0
HEIGHT = 0 NAME = "myApplet"
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab#Version=1,3,1,3">
<PARAM NAME = CODE VALUE = "FooApplet.class" >
<PARAM NAME = CODEBASE VALUE = "http://foo.com/java/" >
<PARAM NAME = ARCHIVE VALUE = foo.jar" >
<PARAM NAME = NAME VALUE = "fooApplet" >
<PARAM NAME = MAYSCRIPT VALUE = true >
<PARAM NAME = "type" VALUE =
"application/x-java-applet;jpi-version=1.3.1_03">
<PARAM NAME = "scriptable" VALUE = "true">
<COMMENT>
</COMMENT>
</OBJECT>
The code above works fine in IE6/XP. For dyn. insertion, I try the
code below, but it does not load the applet properly. Any ideas?
<SCRIPT language="JavaScript">
var obj = document.createElement("object");
obj.setAttribute("classid", "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
obj.setAttribute("width", "0");
obj.setAttribute("height", "0");
obj.setAttribute("name", "myApplet");
obj.setAttribute("id", "myApplet");
obj.setAttribute("codebase",
"http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab#Version=1,3,1,3");
var p1 = document.createElement("param");
p1.setAttribute("name", "code");
p1.setAttribute("value", "FooApplet.class");
obj.appendChild(p1);
var p2 = document.createElement("param");
p2.setAttribute("name", "codebase");
p2.setAttribute("value", "http://foo.com/java/");
obj.appendChild(p2);
var p3 = document.createElement("param");
p3.setAttribute("name", "archive");
p3.setAttribute("value", "foo.jar");
obj.appendChild(p3);
var p4 = document.createElement("param");
p4.setAttribute("name", "name");
p4.setAttribute("value", "fooApplet");
obj.appendChild(p4);
var p5 = document.createElement("param");
p5.setAttribute("name", "mayscript");
p4.setAttribute("value", "true");
obj.appendChild(p5);
var p6 = document.createElement("param");
p6.setAttribute("name", "scriptable");
p4.setAttribute("value", "true");
obj.appendChild(p6);
var p7 = document.createElement("param");
p7.setAttribute("name", "type");
p4.setAttribute("value",
"application/x-java-applet;jpi-version=1.3.1_03");
obj.appendChild(p7);
document.body.appendChild(obj);
</SCRIPT>
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 0
HEIGHT = 0 NAME = "myApplet"
codebase="http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab#Version=1,3,1,3">
<PARAM NAME = CODE VALUE = "FooApplet.class" >
<PARAM NAME = CODEBASE VALUE = "http://foo.com/java/" >
<PARAM NAME = ARCHIVE VALUE = foo.jar" >
<PARAM NAME = NAME VALUE = "fooApplet" >
<PARAM NAME = MAYSCRIPT VALUE = true >
<PARAM NAME = "type" VALUE =
"application/x-java-applet;jpi-version=1.3.1_03">
<PARAM NAME = "scriptable" VALUE = "true">
<COMMENT>
</COMMENT>
</OBJECT>
The code above works fine in IE6/XP. For dyn. insertion, I try the
code below, but it does not load the applet properly. Any ideas?
<SCRIPT language="JavaScript">
var obj = document.createElement("object");
obj.setAttribute("classid", "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
obj.setAttribute("width", "0");
obj.setAttribute("height", "0");
obj.setAttribute("name", "myApplet");
obj.setAttribute("id", "myApplet");
obj.setAttribute("codebase",
"http://java.sun.com/products/plugin/autodl/jinstall-1_3_1_03-win.cab#Version=1,3,1,3");
var p1 = document.createElement("param");
p1.setAttribute("name", "code");
p1.setAttribute("value", "FooApplet.class");
obj.appendChild(p1);
var p2 = document.createElement("param");
p2.setAttribute("name", "codebase");
p2.setAttribute("value", "http://foo.com/java/");
obj.appendChild(p2);
var p3 = document.createElement("param");
p3.setAttribute("name", "archive");
p3.setAttribute("value", "foo.jar");
obj.appendChild(p3);
var p4 = document.createElement("param");
p4.setAttribute("name", "name");
p4.setAttribute("value", "fooApplet");
obj.appendChild(p4);
var p5 = document.createElement("param");
p5.setAttribute("name", "mayscript");
p4.setAttribute("value", "true");
obj.appendChild(p5);
var p6 = document.createElement("param");
p6.setAttribute("name", "scriptable");
p4.setAttribute("value", "true");
obj.appendChild(p6);
var p7 = document.createElement("param");
p7.setAttribute("name", "type");
p4.setAttribute("value",
"application/x-java-applet;jpi-version=1.3.1_03");
obj.appendChild(p7);
document.body.appendChild(obj);
</SCRIPT>