How to call a Javascript func from an Applet.

R

Roberto Gallo

Hello again;


My objective is to construct a small control structure to coordinate
some applets that are in a single page and need some concurrence control
mechanism and messaging.

I expect to do that using Javascript. I have an applet that needs to
call a Javascript function that is inside the same page the Applet.

How can I do that?





Thank you.

Roberto Gallo.
 
A

Andrew Thompson

Roberto Gallo wrote:
....
My objective is to construct a small control structure to
coordinate some applets that are in a single page and need some
concurrence control mechanism and messaging.

I expect to do that using Javascript.

Why? Why not use another Applet?

The group of people with the relevant
Java, is (slightly) larger than those with
both the relevant Java *and* JS enabled.

[ And, yes, I do know people who
have Java installed, but JS disabled. ]
 
R

Roberto Gallo

Andrew Thompson said:
Roberto Gallo wrote:
...
My objective is to construct a small control structure to
coordinate some applets that are in a single page and need some
concurrence control mechanism and messaging.

I expect to do that using Javascript.

Why? Why not use another Applet?

The group of people with the relevant
Java, is (slightly) larger than those with
both the relevant Java *and* JS enabled.

[ And, yes, I do know people who
have Java installed, but JS disabled. ]

I didn´t know it was possible. After a google I could find it.
Thank you.
 
T

Thomas Fritsch

Roberto said:
Hello again;


My objective is to construct a small control structure to coordinate
some applets that are in a single page and need some concurrence control
mechanism and messaging.

I expect to do that using Javascript. I have an applet that needs to
call a Javascript function that is inside the same page the Applet.

How can I do that?
First in the HTML file your applet needs the permission to call JavaScript:
<applet .................. mayscript="true" >

Then in your applet code you can do like this:

import netscape.javascript.*;
....
// first get the window containing your applet:
JSObject window = JSObject.getWindow(this);
// then you can call any javascript stuff:
window.eval("alert('hello')");
...

For more information about the package netscape.javascript (classes
JSObject and JSException) see for example:
http://members.ozemail.com.au/~phoenix1/html/packages.htm
or google for "netscape.javascript.JSObject".

Thomas


______________________________________________________
Thomas <dot> Fritsch <at> ops <dot> de
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top