document.applets & object

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Neil Cherry

    #1

    document.applets & object

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

    BTW, the FAQS page seems to be broken.

    --
    Linux Home Automation Neil Cherry ncherry@comcast .net
    http://home.comcast.net/~ncherry/ (Text only)
    http://hcs.sourceforge.net/ (HCS II)
    http://linuxha.blogspot.com/ My HA Blog
  • Martin Honnen

    #2
    Re: document.applet s &amp; object



    Neil Cherry wrote:
    [color=blue]
    > I've seen references to using <applets ... > and document.applet s to
    > access public Java functions from Javascript. Do I still use
    > document.applet s with <object ...>?[/color]

    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="applicati on/x-java-applet"
    and/or
    <object code="java:Some Applet.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.getEl ementById && (applet =
    document.getEle mentById('objec tId')) && typeof applet.methodNa me !=
    'undefined') {
    applet.methodNa me();
    }
    to call a method if available. That doesn't depend on the browser making
    an applet available in document.applet s but is supported from IE 5+,
    Netscape 6+, Mozilla, Opera 6+.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/

    Comment

    • Neil Cherry

      #3
      Re: document.applet s &amp; object

      On Wed, 19 Jan 2005 19:08:34 +0100, Martin Honnen wrote:[color=blue]
      >
      >
      > Neil Cherry wrote:
      >[color=green]
      >> I've seen references to using <applets ... > and document.applet s to
      >> access public Java functions from Javascript. Do I still use
      >> document.applet s with <object ...>?[/color]
      >
      > Good question but hard to answer, I think that will depend on the
      > browser and even with a particular browser[/color]

      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.
      [color=blue]
      > or the IE/Win
      > <object classid="[/color]

      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).
      [color=blue]
      > 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.getEl ementById && (applet =
      > document.getEle mentById('objec tId')) && typeof applet.methodNa me !=
      > 'undefined') {
      > applet.methodNa me();
      > }
      > to call a method if available. That doesn't depend on the browser making
      > an applet available in document.applet s but is supported from IE 5+,
      > Netscape 6+, Mozilla, Opera 6+.[/color]

      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 ncherry@comcast .net
      http://home.comcast.net/~ncherry/ (Text only)
      http://hcs.sourceforge.net/ (HCS II)
      http://linuxha.blogspot.com/ My HA Blog

      Comment

      • Jim Ley

        #4
        Re: document.applet s &amp; object

        On Wed, 19 Jan 2005 11:19:19 -0600, Neil Cherry <njc@wolfgang.u ucp>
        wrote:
        [color=blue]
        >BTW, the FAQS page seems to be broken.[/color]

        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.

        Comment

        • Neil Cherry

          #5
          Re: document.applet s &amp; object

          On Thu, 20 Jan 2005 23:18:00 GMT, Jim Ley wrote:[color=blue]
          > On Wed, 19 Jan 2005 11:19:19 -0600, Neil Cherry <njc@wolfgang.u ucp>
          > wrote:
          >[color=green]
          >>BTW, the FAQS page seems to be broken.[/color]
          >
          > 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.[/color]

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

          http://JavaScript.FAQTs.com/

          --
          Linux Home Automation Neil Cherry ncherry@comcast .net
          http://home.comcast.net/~ncherry/ (Text only)
          http://hcs.sourceforge.net/ (HCS II)
          http://linuxha.blogspot.com/ My HA Blog

          Comment

          Working...