• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to invoke applets public methods from Javascirpt

 
Venkata Ramana
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I declared applet in <jsp lugin> tag as
<jsp lugin type="applet" code="Aplt.class" codebase="/examples/jsp/plugin/applet" name="Fractal" jreversion="1.3"
iepluginurl="\Serv\JavaRunTime/j2re-1_3_1-win.exe"
nspluginurl="\Serv\JavaRunTime/j2re-1_3_1-win.exe"
width="500" height="120" >
Now i need to to call applets public methods from my java script. How can i do this.
In my code i called like this
document.Fractal.change();
in <java lugin> tag i used name attribute to assign reference to my applet, i used 'Fractal' as my applet reference name.
but the above call is giving error as
document.Fractal is null or not an object.
If i am using <OBJECT> tag for declaring applet i am able to call the applets methods from javascript.
 
Joe Crew
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramana,
I don't know about using the lugin you are talking about but here is an example that I use on a daily basis.

My code is packed into the jar file mom.jar and in there is a class named Client.class. I call a public method in Client.class named
"send(Message msg)".
In my javascript code here is how I call it:
mom.send(myMessage);
In the applet I gave my applet the name "mom". When I called my java function I used mom.functionName() to invoke it.
Also note in the applet declaration the use of the word MAYSCRIPT in the applet. You do have the ability to use JSObject on the Java side right?
Joe Crew
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic