By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,605 Members | 2,129 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,605 IT Pros & Developers. It's quick & easy.

Firefox not calling an applet method

P: n/a
Hi,
I have a .jsp file in the following format:

.... html headers, jsp code, html code...

<jsp:plugin
type="applet"
code="path.in.packet.appletclassname.class"
codebase=".."
jreversion="1.5"
archive="packetname.jar"
height="0"
width="0"
name="appletname"

<jsp:fallback>
<p>Unable to start the applet.</p>
</jsp:fallback>
</jsp:plugin>

.... html code...

<script type="text/javascript">
var theApplet = document.applets.appletname;
methodOutput = theApplet.callmethod();
document.write(methodOutput);
</script>

.... the rest of the html code ...

Javascript can call this method with IE 6.0, but with Firefox I get the
following message: "Error: theApplet has no properties".

And here is how Firefox and IE6.0 translate my <jsp:plugin> tag:

<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
name="appletname"
width="0" height="0"
codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">;
<PARAM name="java_code" value="path.in.packet.appletclassname.class">
<PARAM name="java_codebase" value="..">
<PARAM name="java_archive" value="packetname.jar">
<PARAM name="type" value="application/x-java-applet;version=1.5">

<COMMENT>
<EMBED type="application/x-java-applet;version=1.5" name="appletname"
width="0"
height="0" pluginspage="http://java.sun.com/products/plugin/";
java_code="path.in.packet.appletclassname.class"
java_codebase=".."
java_archive="packetname.jar"
clientLocale="en_IE">
<NOEMBED>
</COMMENT>

<p>Unable to start the applet.</p>

</NOEMBED></EMBED>
</OBJECT>

I have already tried other solutions, like
document.getElementsByName() and
document.embeds ( as well as document.getElementsByID, but this could
never work with Firefox as, from what I found in google, Firefox does
not assume that applet name = applet id, what IE does).
Still, I never managed to call this method with Firefox.
Would anyone have any other ideas?

Thank you,

Blondie

Sep 26 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a


Blondie21 wrote:

<script type="text/javascript">
var theApplet = document.applets.appletname;
methodOutput = theApplet.callmethod();
document.write(methodOutput);
To access an object like an applet in the DOM and be able to call its
methods the object needs to be loaded and intialized so your chance to
script an applet by putting the above code simply somewhere in the body
of the HTML document are very low as it is executed while the document
is loaded.
Put the applet in the HTML document and then use script in the onload
handler to try to script the applet. Of course that script can't do
document.write then but I guess that attempt above is only some poor
attempt at debugging.
Or place a button in the HTML document which in its onclick handler
tries to script the applet.

And here is how Firefox and IE6.0 translate my <jsp:plugin> tag:

<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"


The browser does not translate any <jsp> tags at all, your server side
framework does that and then delivers HTML or HTML tag soup to the browser.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Sep 26 '05 #2

P: n/a
Martin Honnen wrote:

To access an object like an applet in the DOM and be able to call its
methods the object needs to be loaded and intialized so your chance to
script an applet by putting the above code simply somewhere in the body
of the HTML document are very low as it is executed while the document
is loaded.
Put the applet in the HTML document and then use script in the onload
handler to try to script the applet. Of course that script can't do
document.write then but I guess that attempt above is only some poor
attempt at debugging.
Or place a button in the HTML document which in its onclick handler
tries to script the applet.


Thank you for your answer.
No, I'm not using this for debugging.
I still don't understand why this works fine with IE. And what does DOM
have to do with it at all?

Thank you,
Blondie21

Sep 27 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.