Read Form fields from Applet. Do I need Javascript?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Roberto Gallo

    #1

    Read Form fields from Applet. Do I need Javascript?



    Hi,

    I have an applet running inside an html document and I need to read and
    to set some of html form's textfield and textarea input from my applet.

    How can I do that? Do I need a javascript?

    Thank you,

    Roberto Gallo

  • Martin Honnen

    #2
    Re: Read Form fields from Applet. Do I need Javascript?



    Roberto Gallo wrote:
    [color=blue]
    > I have an applet running inside an html document and I need to read and
    > to set some of html form's textfield and textarea input from my applet.
    >
    > How can I do that? Do I need a javascript?[/color]

    You need LiveConnect Java --> JavaScript so start with
    <applet mayscript ...></applet>
    in the HTML markup so that the browser allows the applet to call into
    script.
    Then in the Java applet you need to import
    import netscape.javasc ript.*;
    then you can do
    JSObject window = JSObject.getWin dow(this);
    in the applet to get the JavaScript window object wrapped as a JSObject
    in Java. Then you can access members, call methods or evaluate script
    code, see
    <http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/java_js.html>
    for details.


    --

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

    Comment

    Working...