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

document.applets & object

P: n/a
I've seen references to using <applets ... > and document.applets to
access public Java functions from Javascript. Do I still use
document.applets with <object ...>?

BTW, the FAQS page seems to be broken.

--
Linux Home Automation Neil Cherry nc*****@comcast.net
http://home.comcast.net/~ncherry/ (Text only)
http://hcs.sourceforge.net/ (HCS II)
http://linuxha.blogspot.com/ My HA Blog
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a


Neil Cherry wrote:
I've seen references to using <applets ... > and document.applets to
access public Java functions from Javascript. Do I still use
document.applets with <object ...>?


Good question but hard to answer, I think that will depend on the
browser and even with a particular browser I am not sure that it could
not depend on the way you use object, whether you use
<object type="application/x-java-applet"
and/or
<object code="java:SomeApplet.class"
or the IE/Win
<object classid="

I think if you use the <object> element to embed your Java applet then a
safe way should be to give it an id attribute and then use
var applet;
if (document.getElementById && (applet =
document.getElementById('objectId')) && typeof applet.methodName !=
'undefined') {
applet.methodName();
}
to call a method if available. That doesn't depend on the browser making
an applet available in document.applets but is supported from IE 5+,
Netscape 6+, Mozilla, Opera 6+.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

P: n/a
On Wed, 19 Jan 2005 19:08:34 +0100, Martin Honnen wrote:


Neil Cherry wrote:
I've seen references to using <applets ... > and document.applets to
access public Java functions from Javascript. Do I still use
document.applets with <object ...>?
Good question but hard to answer, I think that will depend on the
browser and even with a particular browser


I'm currently using Netscape (Firefox 1.0) but I'd like to see it work
(same code or as close as possible) with IE 6.
or the IE/Win
<object classid="
I'm currently using this for IE & Netscape and it correctly calls up
the Java Applet under both (I also use the object in an object with
<!--[if !IE]> trick).
I think if you use the <object> element to embed your Java applet then a
safe way should be to give it an id attribute and then use
var applet;
if (document.getElementById && (applet =
document.getElementById('objectId')) && typeof applet.methodName !=
'undefined') {
applet.methodName();
}
to call a method if available. That doesn't depend on the browser making
an applet available in document.applets but is supported from IE 5+,
Netscape 6+, Mozilla, Opera 6+.


Excellent! That's what I'll do. Thanks for the help and not poking fun
at my calling the Java method a function. My background is Assembler &
C, so they're all subroutines to me. :-) And I'm doing this for fun
and on-my-own-time education. Thanks again!

--
Linux Home Automation Neil Cherry nc*****@comcast.net
http://home.comcast.net/~ncherry/ (Text only)
http://hcs.sourceforge.net/ (HCS II)
http://linuxha.blogspot.com/ My HA Blog
Jul 23 '05 #3

P: n/a
On Wed, 19 Jan 2005 11:19:19 -0600, Neil Cherry <nj*@wolfgang.uucp>
wrote:
BTW, the FAQS page seems to be broken.


Do you mean
<URL: http://jibbering.com/faq/ > ?

as I don't know of it being down recently, the logs certainly don't
show any holes.

Jim.
Jul 23 '05 #4

P: n/a
On Thu, 20 Jan 2005 23:18:00 GMT, Jim Ley wrote:
On Wed, 19 Jan 2005 11:19:19 -0600, Neil Cherry <nj*@wolfgang.uucp>
wrote:
BTW, the FAQS page seems to be broken.


Do you mean
<URL: http://jibbering.com/faq/ > ?

as I don't know of it being down recently, the logs certainly don't
show any holes.


Oops, sorry about that, forgot the T. The broken site is:

http://JavaScript.FAQTs.com/

--
Linux Home Automation Neil Cherry nc*****@comcast.net
http://home.comcast.net/~ncherry/ (Text only)
http://hcs.sourceforge.net/ (HCS II)
http://linuxha.blogspot.com/ My HA Blog
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.