473,385 Members | 1,275 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,385 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 1861


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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.