Link to home
Start Free TrialLog in
Avatar of StephanM
StephanM

asked on

Exchange arrays between Java applets and JavaScript functions?

In a html-page I want to exchange arrays beetween JavaScript functions and Java applet functions.

I´ve tried the following code, but it returns with the script error
"No Java method matching arguments."

Here are my sample files:

JavaParameterTest.java

import java.applet.*;
public class JavaParameterTest extends Applet
{
      public JavaParameterTest()
      {
      }
      public String Test(String Ar[], int i) {
          return Ar[i];
      }
}

JavaParameterTest.html:

<html>
<head>
<title>JavaParameterTest</title>
<script>
testarray = new Array("Peter","Paul","Mary");
function test() {
  alert(document.JavaParameterTest.Test(testarray(),1));
}
</script>
</head>
<body onload="test();">
<applet
    code=JavaParameterTest.class
    name=JavaParameterTest
 </applet>
</body>
</html>

I there any chance to modify this code, so does it works on IE 3.0 and NS 3.0?

I would appreciate any help.
Avatar of NickRS051397
NickRS051397

In the JavaScript you're trying to call a function testarray().
To pass an array use testarray[].
Avatar of StephanM

ASKER

Your proposal is not the right solution, because if I change
the argument for my applet from testarray() to testarray[],
it produces a syntax error in Netscape. Sorry.
Adjusted points to 120
ASKER CERTIFIED SOLUTION
Avatar of garik
garik

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your response. I´ve checked it and it´s true -
there is in fact no chance to exchange arrays in the ie.

Concentrating on content and not on incompatibilities
would be nice, but I don´t think it will happen.

Over and out, StephanM.