🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.javascript
Article #89

Problem with applet/javascript on Mac platform

#89
From: Alex Pavlov
Date: Wed, 30 Aug 2000 00:00
73 lines
3021 bytes
Greetings....
I try to call java applet from javascript. On Win32 all work fine, but I
have troubles on Mac platform.
Troble with IE on Mac:
    I recieve error message 'object has no properties' in line of
javascript, where I call method of applet.
Trouble with NN on Mac:
    I receive exception while loading applet:
Netscape Communications Corporation -- Java 1.1.5
Type '?' for options.
Symantec Java! ByteCode Compiler Copyright (C) 1996-97 Symantec
Corporation
# Applet exception: class testapplet not found
java.lang.ClassNotFoundException: java/awt/event/ActionListener
  at java.lang.ClassLoader.defineClass(Compiled Code)
  at netscape.applet.AppletClassLoader.findClass(Compiled Code)
  at netscape.applet.AppletClassLoader.loadClass1(Compiled Code)
* at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
  at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
  at netscape.applet.DerivedAppletFrame.run(Compiled Code)
  at java.lang.Thread.run(Compiled Code)

 I get reference to loaded applet via such lines in Javascript and this
code work fine:

          var appletRef = document.applets[0];
or
          var appletRef = document.applets['appletName'];
or
          var appletRef = document.apletName;


then call your applet in javascript using:
            appletRef.appletMethod('paramToApplet');
I receive error message on this line in IE.

I use this applet for example:

import java.awt.*;
import java.applet.Applet;

public class testapplet extends Applet {
  public String myString;
  TextField myField;

  public void init() {
    setLayout(new BorderLayout());
    myField = new TextField();
    myField.setEditable(false);
    add("Center", myField);
    setString("Initial string");
  }

  public void setString(String s) {
    myField.setText(s);
  }
}

example of HTML:
...
<APPLET CODE=testapplet.class WIDTH=150 HEIGHT=25>
</APPLET>
<FORM>
<INPUT TYPE="text" NAME=mytext SIZE=50>
<INPUT TYPE="button" VALUE="evaluate"
onClick="document.applets[0].setString(eval(this.form.mytext.value))">
</FORM>
...

    Any suggestion?
    Sincerely, Alex Pavlov.
eVelopers, Inc
apavlov @ evelopers.com
Technical Details
Message-ID: <39AD27D7.6F0CF600@evelopers.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb3cb,a83658b29759f126,start
X-Google-Attributes: gidfb3cb,public
X-Google-Thread: ff01d,a83658b29759f126,start
X-Google-Attributes: gidff01d,public
From: Alex Pavlov <apavlov@evelopers.com>
Subject: Problem with applet/javascript on Mac platform
Date: 2000/08/30
Message-ID: <39AD27D7.6F0CF600@evelopers.com>
X-Deja-AN: 664362261
Content-Transfer-Encoding: 7bit
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: usenet@news.metrocom.ru
X-Trace: news.metrocom.ru 967649242 3296 212.119.183.70 (30 Aug 2000 15:27:22 GMT)
Organization: Metrocom JSC Internet News Site
Mime-Version: 1.0
NNTP-Posting-Date: 30 Aug 2000 15:27:22 GMT
Newsgroups: comp.lang.javascript,borland.public.jbuilder.applet-issues