Load Applet via Javascript function on the same page
I am trying to load an applet on demand via javascript.
Here is what I've tried:
function startApplet() {
document.write('<applet code="com.pwc.envoya开发者_如何转开发pp.applet.SampleApplet" height=30 width=40 archive="ucfapplet.jar"></applet>');
}
The problem is that it loads the applet in a new page. I need it to open it on the same page so that session keys generated by the applet are preserved.
Is there a way to get the applet to load on the same page?
have you tried something like:
document.getElementById("appletContainer").innerHTML = "<applet ... />";
of course you'd need the element to exist so somewhere in your DOM you'd have:
<div id="appletContainer"></div>
as an empty element waiting to be populated.
精彩评论