After years of successfully maintaining an applet that utilizes the traditional:
<script src="foo.js"></script>
method for embedding a Java applet, we can no longer ignore the need for change.
It's time to switch to:
deployJava.runApplet()
When I invoke this method using a click handler (such as an event listener on a button with jQuery, although the method doesn't matter):
$('#button').click(function() {
deployJava.runApplet(attributes, parameters, version);
});
...it replaces the entire existing document with the applet. How can I specify a specific DOM element to contain the applet, so my page isn't completely replaced?
I thought there might be an attribute like target: someElement
where "someElement" could be a DOM object or the element's ID as a string. However, I haven't been able to find documentation for such an attribute.
Just to provide all information, here are the attributes being passed:
/* A possible location for an applicable attribute */
var attributes = {
name: "SomeName",
code: "some.class",
archive: "some.jar",
width: 640,
height: 400
};
var parameters = {
someParameter: someValue
};
var version = "1.5";
I could use document.write
to reconstruct the document, but you can understand why I'd prefer to avoid that approach.
Any guidance would be much appreciated.