Error When Placing a Java Object With ECMAScript in Internet Explorer

Issues When Using Nested 'Object' Elements, CSS and ECMAScript

I am writing this document to point out an error that occurs in Internet Explorer while trying to place java applets with ECMAScript. Check out the following link if you would like to learn more about placing Freemind applets in XHTML documents .

The following code:

function cc() { //create content
      function testfmA() {
            var pA0 = crEl("param","scriptable","false");
            var pA1 = crEl("param","modes","freemind.modes.browsemode.BrowseMode");
            var pA2 = crEl("param","browsemode_initial_map","http://rolandog.com/freemind/Polietileno.mm");
            var pA3 = crEl("param","initial_mode","Browse");
            var pA4 = crEl("param","selection_method","selection_method_direct");
            var oA = crEl("object","class","java","classid","java:freemind.main.FreeMindApplet.class","type","application/x-java-applet","archive","http://rolandog.com/freemind/freemindbrowser.jar","width","600","height","400",pA0,pA1,pA2,pA3,pA4);
            return oA;
      }
      function testfmB() {
            var pB0 = crEl("param","code","freemind.main.FreeMindApplet");
            var pB1 = crEl("param","archive","http://rolandog.com/freemind/freemindbrowser.jar");
            var pB2 = crEl("param","scriptable","false");
            var pB3 = crEl("param","modes","freemind.modes.browsemode.BrowseMode");
            var pB4 = crEl("param","browsemode_initial_map","http://rolandog.com/freemind/Polietileno.mm");
            var pB5 = crEl("param","initial_mode","Browse");
            var pB6 = crEl("param","selection_method","selection_method_direct");
            var sB0 = crEl("strong","tn","This browser does not have a Java Plug-in.");
            var bB0 = crEl("br");
            var aB0 = crEl("a","href","http://java.sun.com/products/plugin/downloads/index.html","tn","Get the latest Java Plug-in here.");
            var oB = crEl("object","classid","clsid:8AD9C840-044E-11D1-B3E9-00805F499D93","codebase","http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab","width","600","height","400",pB0,pB1,pB2,pB3,pB4,pB5,pB6,sB0,bB0,aB0);
            return oB;
      }
      var tA = testfmA();
      var tB = testfmB();
      tA.appendChild(tB);
      appendChild("testfm1",tA);
}

Is the equivalent of:

function testfmC() {
      var pC0 = document.createElement("param");
      var pC1 = document.createElement("param");
      var pC2 = document.createElement("param");
      var pC3 = document.createElement("param");
      var pC4 = document.createElement("param");
      pC0.setAttribute("name","scriptable");
      pC0.setAttribute("value","false");
      pC1.setAttribute("name","modes");
      pC1.setAttribute("value","freemind.modes.browsemode.BrowseMode");
      pC2.setAttribute("name","browsemode_initial_map");
      pC2.setAttribute("value","http://rolandog.com/freemind/Polietileno.mm");
      pC3.setAttribute("name","initial_mode");
      pC3.setAttribute("value","Browse");
      pC4.setAttribute("name","selection_method");
      pC4.setAttribute("value","selection_method_direct");
      var oC = document.createElement("object");
      oC.setAttribute("classid","java:freemind.main.FreeMindApplet.class");
      oC.setAttribute("type","application/x-java-applet");
      oC.setAttribute("archive","http://rolandog.com/freemind/freemindbrowser.jar");
      oC.setAttribute("width","600");
      oC.setAttribute("height","400");
      oC.appendChild(pC0);
      oC.appendChild(pC1);
      oC.appendChild(pC2);
      oC.appendChild(pC3);
      oC.appendChild(pC4);
      return oC;
}
function testfmD() {
      var pD0 = document.createElement("param");
      var pD1 = document.createElement("param");
      var pD2 = document.createElement("param");
      var pD3 = document.createElement("param");
      var pD4 = document.createElement("param");
      var pD5 = document.createElement("param");
      var pD6 = document.createElement("param");
      var sD0 = document.createElement("strong");
      var bD0 = document.createElement("br");
      var aD0 = document.createElement("a");
      var tD0 = document.createTextNode("This browser does not have a Java Plug-in.");
      var tD1 = document.createTextNode("Get the latest Java Plug-in here.");
      pD0.setAttribute("name","code");
      pD0.setAttribute("value","freemind.main.FreeMindApplet");
      pD1.setAttribute("name","archive");
      pD1.setAttribute("value","http://rolandog.com/freemind/freemindbrowser.jar");
      pD2.setAttribute("name","scriptable");
      pD2.setAttribute("value","false");
      pD3.setAttribute("name","modes");
      pD3.setAttribute("value","freemind.modes.browsemode.BrowseMode");
      pD4.setAttribute("name","browsemode_initial_map");
      pD4.setAttribute("value","http://rolandog.com/freemind/Polietileno.mm");
      pD5.setAttribute("name","initial_mode");
      pD5.setAttribute("value","Browse");
      pD6.setAttribute("name","selection_method");
      pD6.setAttribute("value","selection_method_direct");
      aD0.setAttribute("href","http://java.sun.com/products/plugin/downloads/index.html");
      var oD = document.createElement("object");
      oD.setAttribute("class","java");
      oD.setAttribute("classid","clsid:8AD9C840-044E-11D1-B3E9-00805F499D93");
      oD.setAttribute("codebase","http://java.sun.com/update/1.5.0/jinstall-1_5_0-windows-i586.cab");
      oD.setAttribute("width","600");
      oD.setAttribute("height","400");
      sD0.appendChild(tD0);
      aD0.appendChild(tD1);
      oD.appendChild(pD0);
      oD.appendChild(pD1);
      oD.appendChild(pD2);
      oD.appendChild(pD3);
      oD.appendChild(pD4);
      oD.appendChild(pD5);
      oD.appendChild(pD6);
      oD.appendChild(sD0);
      oD.appendChild(bD0);
      oD.appendChild(aD0);
      return oD;
}
var tC = testfmC();
var tD = testfmD();
tC.appendChild(tD);
document.getElementById("testfm2").appendChild(tC);

Below this paragraph I will place two Java Applets with both code segments.

First Function


Second Function

There should be two Freemind Mindmaps above, but the code doesn't seem to work in Internet Explorer, since it causes an error when appending an object to another object. There are errors on lines 43 and 179 in IE. You can click the following links to see the code created by the first function or by the second function . You can also compare it to the static code .

The following section is the 'static' version of code, just for demonstration purposes.

This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

Additional Information

JavaScript is another name for ECMAScript. Freemind is a premier free mind-mapping software written in Java. Questions, comments? Email: rolandog@gmail.com . Visit: http://rolandog.com/ , http://freemind.sourceforge.net/ .