How can I dynamically set an applet's param values using JavaScript?

Jorge Jordão

Use document.write to generate the APPLET and enclosing PARAM tags.

        <SCRIPT LANGUAGE="JavaScript">

            function writeAppletTag() {
                document.writeln('<APPLET CODE="MyApplet" WIDTH="100" HEIGHT="100">');

            function buildParamTag(name, value) {
                return '<PARAM NAME="' + name + '" VALUE="' + value + '">';

        <SCRIPT LANGUAGE="JavaScript">

In the example, the parameter names and values are static, but they could for instance be fetched from cookies.

NOTE: Don't bother trying to generate only the PARAM tags (and leave the APPLET tag as regular HTML) because it won't work.
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.