Folks,
I was sure this could be done - or at least sure I had seen reference to
it at some point or other - but now, after having gone for a cup of tea,
am begining to doubt my original belief.
Can I have a script, available in a parent function, called from a child
window? If so, how?
And... if so, why? I mean, while sipping my tea, I realised that if the
child window had a <script src> tag calling a javascript file that was
already cached, then it would (in theory) be instantly available...
My attempts so far have revolved around trying object 'calls' like
top.document.fu nctionName(arg1 , arg2) but this has failed.
and... if I have a variable defined in a script file, loaded in the
parent window, how can I refer to it from the child window?
All help, via the newsgroup please, is much apprecaited, thanks
randelld 2 7881
On Sat, 03 Apr 2004 01:38:48 GMT, Reply Via Newsgroup
<re************ ****@please.com > wrote: Can I have a script, available in a parent function, called from a child window?
Assuming that the script in question has been loaded and parsed, yes.
If so, how?
Use the window.opener property to refer to the parent window. The use of
self, top, and parent relates to frames, not open windows.
And... if so, why? I mean, while sipping my tea, I realised that if the child window had a <script src> tag calling a javascript file that was already cached, then it would (in theory) be instantly available...
If cached, the file will be available. However, that doesn't mean that
it's been parsed, and it's functions and variables ready.
[snipped call with top]
and... if I have a variable defined in a script file, loaded in the parent window, how can I refer to it from the child window?
Just as you would with frames, only using the window.opener property:
opener.myFuncti on();
opener.myVar = 'some value';
Mike
--
Michael Winter M.******@blueyo nder.co.invalid (replace ".invalid" with ".uk" to reply)
Michael Winter wrote: On Sat, 03 Apr 2004 01:38:48 GMT, Reply Via Newsgroup <re************ ****@please.com > wrote:
Can I have a script, available in a parent function, called from a child window?
Assuming that the script in question has been loaded and parsed, yes.
If so, how?
Use the window.opener property to refer to the parent window. The use of self, top, and parent relates to frames, not open windows.
And... if so, why? I mean, while sipping my tea, I realised that if the child window had a <script src> tag calling a javascript file that was already cached, then it would (in theory) be instantly available...
If cached, the file will be available. However, that doesn't mean that it's been parsed, and it's functions and variables ready.
[snipped call with top]
and... if I have a variable defined in a script file, loaded in the parent window, how can I refer to it from the child window?
Just as you would with frames, only using the window.opener property:
opener.myFuncti on(); opener.myVar = 'some value';
Mike
Thanks - My javascript skills are getting better and better - clear
answers like what you've offered above that I've got from this newsgroup
over the past months deserve alot of credit.
Cheers,
Randell D. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Bostonasian |
last post by:
I am trying to append options to dropdown in parent window from option
items in child window.
In parent window, I have following code:
<script language="javascript">
function AddItem2DropDown(item){
exists = false;
for(d=0;d<drpDwn.length;d++){
if(drpDwn.options.value == item.value)
|
by: Randell D. |
last post by:
Folks,
I have got this working before, in part with some help from this ng but
I never really understood how I got it working... and last time, I was
using it via a popup window as opposed to an IFRAME. I've got several
months of javascript under my belt and can resolve most things without
errors in my Mozilla Javascript Console, but this one just does not do
it for me.
This is the picture:
|
by: Bill Borg |
last post by:
Hello all,
Simple chat app, where the site owner has a master window with all requests
for chat, status of each room, etc., and child windows for each separate chat
in which the owner is engaged. When the owner closes one of his child
windows, I want to update the master window.
I understand "reasonably" well how to go about this. The master window
launches the children, and maintains an associative array to keep track of
each one....
|
by: jd |
last post by:
Hi guys, I'm trying to create an HTML page that contains two frames.
The bottom frame should simply be some website, but the top frame needs
to have a close link to kill the window. I tried calling
'document.window.close()' from the child frame, but without success. I
then tried putting the 'close()' call in the parent page and calling it
from the child, but still without success.
Can anyone take a look at the HTML/Javascript below and...
|
by: Bhishm |
last post by:
Hi,
I am opening a child window from parent using window.open, but on
refreshing the parent the reference of the child is lost.
Is there any way to save the reference of the child in the parent
after refresh.
I have searched a lot but not able to find any relevant information
| |
by: Nithu25 |
last post by:
Hi All,
I have a parent window where i have three links. On clicking those links, new window will be opened as a pop up. When i logout from the parent window, the child windows should be closed.
I can close the child windows when i close the parent window using the following code
The following function i am calling "onUnload" event in the body tag of parent window.
|
by: nupuragr82 |
last post by:
I have a parent form and on button click I am calling a child page where i have a textbox and a button. On button click of child form I am passing the value of the Textbox to the Textbox in parent page and now I want to fire an event.
Button click event on parent page- parameter is txtBlank (TextBox in parent page)
function SetRange(Src)
{
window.open("SetRange.aspx?src=" + Src, "_blank", "status = 1, ontop=true, height=110,...
|
by: Buddha |
last post by:
Hello,
I posted this on two forums, without too much help .. and I am kinda
stuck in this.
I need to refresh the parent page from the second child window which
is opened by the first child and the first child window closes after
opening the second child.
This is the second time I am typing the post, I lost all content
because the site complaine I was using the lesser than symbol.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |