473,394 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Calling JS Functions from an applet..

SPG
Hi,

I have a requirement to call a method on a page from an applet that is not
the page that owns the applet..

For example.

Page A has the applet.
It opens page B.

Something happens that makes the applet call a method (Javascript).

I need to be able to call method DoSomething() in Page B from the applet.

I know how to call a method on the main page by using the JSObject returned
from getWindow(this); in the applet.

Is there a way I can pass the reference of the new spawned window into the
applet so I can then call the method on this page?

Cheers,

Steve
Jul 23 '05 #1
2 1862


SPG wrote:

I have a requirement to call a method on a page from an applet that is not
the page that owns the applet..

For example.

Page A has the applet.
It opens page B.
If script in page A opens page B make sure you store the window
reference in a global variable:
var win;
win = window.open('pageB.html', 'winB');
Something happens that makes the applet call a method (Javascript).

I need to be able to call method DoSomething() in Page B from the applet.

I know how to call a method on the main page by using the JSObject returned
from getWindow(this); in the applet.

Is there a way I can pass the reference of the new spawned window into the
applet so I can then call the method on this page?


then in the applet you should be able to access the variable win as a
member of
JSObject window = getWindow(this);
JSObject win = window.getMember("win");
win.call("functionName", arg)
Of course the usual JavaScript restrictions of same origin policy will
apply so page A and B should come from the same server.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #2
SPG
Bingo!

Thanks, solved my problem!

Steve
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:40********@olaf.komtel.net...


SPG wrote:

I have a requirement to call a method on a page from an applet that is not the page that owns the applet..

For example.

Page A has the applet.
It opens page B.


If script in page A opens page B make sure you store the window
reference in a global variable:
var win;
win = window.open('pageB.html', 'winB');
Something happens that makes the applet call a method (Javascript).

I need to be able to call method DoSomething() in Page B from the applet.
I know how to call a method on the main page by using the JSObject returned from getWindow(this); in the applet.

Is there a way I can pass the reference of the new spawned window into the applet so I can then call the method on this page?


then in the applet you should be able to access the variable win as a
member of
JSObject window = getWindow(this);
JSObject win = window.getMember("win");
win.call("functionName", arg)
Of course the usual JavaScript restrictions of same origin policy will
apply so page A and B should come from the same server.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Rowland | last post by:
Hi, I know this question has prob. been asked a million times, but I couldn't find it in the FAQ, so here goes : I'm trying to write a Java applet to call a dll that resides on the web server...
3
by: Jon-Paul Dobson | last post by:
Hi, We have an applet that implements the MouseListener interface but when trying to add the applet to the glasspane of another applet a classcastexception is thrown. This all seemed to work...
1
by: SPG | last post by:
Hi, We have an applet that has to support the SUN VMs as well as the MS VM. The applet receives updates from a server (via tcp or http) and wraps them up as objects and passes them using the...
2
by: Blondie21 | last post by:
Hi, I have a .jsp file in the following format: .... html headers, jsp code, html code... <jsp:plugin type="applet" code="path.in.packet.appletclassname.class" codebase=".."...
2
by: Neil Cherry | last post by:
I've done a fair amount of searching on this subject and I can call my Java methods with Javascript if I use the <applet></applet> tags but when I switch over to <object></object> tags I'm not...
3
by: Jakub Gutkowski | last post by:
Hi, How can I call JavaScript from C#? I've create a Window User Control, that I put on ASP.NET site as Object tag. Now, while some function from my control is being proceed I need to call a...
2
by: Stan R. | last post by:
Hello, I'm wondering how I can enumerate the functions of an applet (like document.applets.myapplet) ? I can get the properties using for (prop in document.applets.myapplet) // do something...
1
by: Stan R. | last post by:
Hello, I'm wondering how I can enumerate the functions of an applet (like document.applets.myapplet) ? In javascript, I can get the properties using for (prop in document.applets.myapplet) //...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.