Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Passing Parameters from Java to JavaScript  RSS feed

Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I'm trying to pass parameters from java to java script.
I'm getting an error " JavaScript error :type 'javascript' into location for details " in the bottom of my screen of my browser(Netscape).
What about setting the class path???
Thanks all for your time.
Here is the codes:
import java.awt.*;
import java.applet.*;
import netscape.javascript.JSObject;
import java.lang.*;

public class array extends java.applet.Applet
public void init()
// Take out this line if you don't use or symantec.itools.awt.util.StatusScroller

// This code is automatically generated by Visual Cafe when you add
// components to the visual environment. It instantiates and initializes
// the components. To modify the code, only use code syntax that matches
// what Visual Cafe can generate, or Visual Cafe may be unable to back
// parse your Java file into its visual environment.

win= JSObject.getWindow(this);
catch(Exception e){}


String testStr;
Integer testInt;
Character testChar;
JSObject win;
Object testArray[]=new Object[3];
void create()

testStr=new String("Test string");
testInt=new Integer(1);
testChar=new Character('a');

catch(Exception e){}
public void paint(Graphics g)
g.drawString("here is an applet ",50,25);

Here is the HTML file
function extractArray(var1,var2,var3)
alert ("java return string: " + var1);
alert ("java return int : " + var2);
alert ("java return char : " + var3);
<input type=button value=click onClick=document.array.create()>

<APPLET name = array code=JSObject.class MAYSCRIPT >

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!