I have converted the following applet tags to object tags so that it can work. But for some reason the below isn’t working. Firstly, Is the below a correct conversion that should work?
Applet:
document.writeln('<applet');
document.writeln(' code="LittleShootApplet"');
document.writeln(' id="LittleShootApplet" name="LittleShootApplet"');
document.writeln(' scriptable="true"');
document.writeln(' mayscript="true"');
document.writeln(' height="0" width="0"');
document.writeln(' style="xdisplay: none; width:0; height:0; padding:0; margin:0;" >');
document.writeln('</applet>');
Object:
document.writeln('<OBJECT ');
document.writeln('classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="0" height="0">');
document.writeln('<PARAM name="code" value="LittleShootApplet">');
document.writeln('<PARAM name="id" value="LittleShootApplet">');
document.writeln('<PARAM name="scriptable" value="true">');
document.writeln('<PARAM name="mayscript" value="true">');
document.writeln('<PARAM name="style" value="xdisplay: none; width:0; height:0; padding:0; margin:0;">');
document.writeln('</OBJECT>');
Btw, I am using JavaScript to write the above to the page.
I have a button on the page which tries to call a Java Applet function using JavaScript but I get this error.
Message: 'document.LittleShootApplet' is null or not an object
Line: 77
Char: 1
Code: 0
URI: http://localhost/webs/front-end/activity.php
The above Javascript is having trouble calling functions from the Java applet because the applet hasn’t been loaded properly.
Thanks all for any help.
Add the ID and Name attributes directly to the
objecttag, not asparam‘s:Removed document.write for readability.
And I would recommend you to get the elements by ID, not by
document.elementName: