Solved

Accessing Main Window

Posted on 1998-12-19
2
192 Views
Last Modified: 2010-04-09
I have a HTML page (let's call this main window Window A) that has an object embedded(using IE 3.022 and above) and a link that when clicked, will use javascript to open/create a small new window (let's call it Window B).

In Window B, there are also links that when clicked, will need to trigger some events of the object embedded in Window A. I used something like this in Window B :

<a href="javascript:????.myObject.myObjectFunc(1)">Do something</a>

So what should I put in ???? to access the function of the object in Window A?

Thanks for helping!
0
Comment
Question by:janeb
2 Comments
 

Author Comment

by:janeb
ID: 1840854
Edited text of question
0
 
LVL 4

Accepted Solution

by:
rafistern earned 50 total points
ID: 1840855
The way to refer to the opening window in JS1.1+ is "opener". In IE3 you will have a problem with "opener" which is not defined in JS1.0

Therefore when you open the window write this

<a href="javascript:newWin=open("...","..","....");if(!newWin.opener)newWin.opener=window;">

Now when you refer back to the opening frame use:

<a href="javascript:opener.window.document.myObject.myObjectFunc(1)">Do something</a>

The syntax "opener.window.document" is in order that the opener will work in IE3 and should not bother IE4 even though "window" is superfluous there.

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to Left-Align Navigation bar? 4 26
how to avoid redundand ajax calls 5 28
execute script based on HTML event 7 22
Javasctipt 2 24
Someone recently asked me about how to display a progress indicator on a page while an iframe is loading. And I remember when I first came across this myself. It was a bit tricky to get my head around, but really, it's very simple. The most impor…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

815 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now