Applet event handlers changed with Java 1.4.x?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Julian Hayward

    #1

    Applet event handlers changed with Java 1.4.x?

    I recently "inherited" a project which involves an applet on a web
    page, and
    some Javascript event handling functions. The handler definition looks
    like
    this:


    <SCRIPT LANGUAGE=javasc ript FOR=Foo EVENT=mouseRele ased>
    <!--
    Foo_mouseReleas ed();
    //-->
    </SCRIPT>

    where Foo is an applet with parameter FiresScriptEven ts set to TRUE.
    The
    function Foo_mouseReleas ed() is a simple javascript function that just
    alerts
    a fixed message so I know it's been called.

    When I run this applet in a vanilla IE5.5 or IE6, it does exactly what
    I expect - when the mouse is released, up pops my alert. BUT when I
    run it on the same browser with Java Plug-In 1.4.2 installed, I don't
    see it. Is there some compatibility issue with 1.4.x? Can the code be
    changed relatively simply to work with both VMs, or am I looking at a
    big rebuild to support browsers both with and without the plug-in?

    Thanks a lot,

    Julian
  • Vincent van Beveren

    #2
    Re: Applet event handlers changed with Java 1.4.x?

    Java plugin is not from microsoft, I guess thats why its not
    supported...

    You could call JavaScript from Java using the Netscape package,
    which, I thought, was included in Internet Explorer...

    Real's HowTo : Useful code snippets for Java, JS, PB and more


    or you could attempt to use:

    getAppletContex t().showDocumen t(
    new URL(
    "javascript:ale rt('Hello')"));

    Greetings,
    Vincent

    Julian Hayward wrote:[color=blue]
    > I recently "inherited" a project which involves an applet on a web
    > page, and
    > some Javascript event handling functions. The handler definition looks
    > like
    > this:
    >
    >
    > <SCRIPT LANGUAGE=javasc ript FOR=Foo EVENT=mouseRele ased>
    > <!--
    > Foo_mouseReleas ed();
    > //-->
    > </SCRIPT>
    >
    > where Foo is an applet with parameter FiresScriptEven ts set to TRUE.
    > The
    > function Foo_mouseReleas ed() is a simple javascript function that just
    > alerts
    > a fixed message so I know it's been called.
    >
    > When I run this applet in a vanilla IE5.5 or IE6, it does exactly what
    > I expect - when the mouse is released, up pops my alert. BUT when I
    > run it on the same browser with Java Plug-In 1.4.2 installed, I don't
    > see it. Is there some compatibility issue with 1.4.x? Can the code be
    > changed relatively simply to work with both VMs, or am I looking at a
    > big rebuild to support browsers both with and without the plug-in?
    >
    > Thanks a lot,
    >
    > Julian[/color]

    Comment

    • Martin Honnen

      #3
      Re: Applet event handlers changed with Java 1.4.x?



      Julian Hayward wrote:
      [color=blue]
      > I recently "inherited" a project which involves an applet on a web
      > page, and
      > some Javascript event handling functions. The handler definition looks
      > like
      > this:
      >
      >
      > <SCRIPT LANGUAGE=javasc ript FOR=Foo EVENT=mouseRele ased>
      > <!--
      > Foo_mouseReleas ed();
      > //-->
      > </SCRIPT>[/color]

      The syntax <script for event> is basically an IE extension, it is not
      supported by other browsers (at least not in general, the latest
      Netscape 7.1 release makes some attempts but as far as I know only to
      support Window Media Player scripting with Netscape 7.1/Windows).

      [color=blue]
      > where Foo is an applet with parameter FiresScriptEven ts set to TRUE.[/color]

      I have never heard of that parameter, and a search on
      http://java.sun.com/ doesn't turn up any results. Nor does a search on
      msdn.microsoft. com.
      Where did you find that parameter, is it one specified for applets run
      with the MS JVM?
      [color=blue]
      > The
      > function Foo_mouseReleas ed() is a simple javascript function that just
      > alerts
      > a fixed message so I know it's been called.
      >
      > When I run this applet in a vanilla IE5.5 or IE6, it does exactly what
      > I expect - when the mouse is released, up pops my alert. BUT when I
      > run it on the same browser with Java Plug-In 1.4.2 installed, I don't
      > see it. Is there some compatibility issue with 1.4.x? Can the code be
      > changed relatively simply to work with both VMs, or am I looking at a
      > big rebuild to support browsers both with and without the plug-in?[/color]

      I would be rather surprised if you can handle events happening inside of
      a Java applet with script in the page containing the applet in a cross
      browser way. I don't think that works with browsers using the Sun Java
      plugin.

      --

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

      Comment

      Working...