473,320 Members | 1,976 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,320 software developers and data experts.

changing opener

Hi,

I have a calendar program that is popped up by a HTML so that the user
can choose a specific date to be filled in via javascript from the
calendar program. I am using window.open() to start the calendar
program and then calling my own function "javascript:opener.setDate()"
to set the date back on the main window. This all works fine if I use
the current month that is displayed, but as soon as I have to rebuild
the calendar because they want to go to another month, the opener is
not being set correctly. The javascript for popping up the calendar
window and changing the month looks like:

function popupCal
{
calWin = window.open('/cgi-script/calWin','calWin');
}

function changeMonth(month)
{
calWin.open('/cgi-script/calWin'+month,'calWin');
alert(calWin.opener.location);
if(calWin.opener == calWin){
calWin.opener = this; // reset back to main window
}
alert(calWin.opener.location);
}

(The alerts were added for debugging.) This all works just fine in
IE, but when trying from Netscape 7.1 or Mozilla, the calWin.opener is
not reset and the alert says the calWin.opener.location is the same as
the calWin.location. Everything I have read about opener says you can
reset it like this, but it doesn't seem to work. Does anyone have any
suggestions?

-Diana
Jul 20 '05 #1
5 6591
DU
Diana Coppenbarger wrote:
Hi,

I have a calendar program that is popped up by a HTML so that the user
can choose a specific date to be filled in via javascript from the
calendar program. I am using window.open() to start the calendar
program and then calling my own function "javascript:opener.setDate()"
to set the date back on the main window.
http://jibbering.com/faq/#FAQ4_24

This all works fine if I use the current month that is displayed, but as soon as I have to rebuild
the calendar because they want to go to another month, the opener is
not being set correctly.

Please elaborate on "the opener is not being set correctly". What do you
mean? Are you saying that the date is not pasted into some input field
in the opener?
Can you provide an url of your page? That would be so convenient here.

The javascript for popping up the calendar window and changing the month looks like:

function popupCal
{
calWin = window.open('/cgi-script/calWin','calWin');
}
I would set explicitly this calWin as a global variable.

function changeMonth(month)
{
calWin.open('/cgi-script/calWin'+month,'calWin');
alert(calWin.opener.location);
if(calWin.opener == calWin){
The boolean conditional expression should always be false. Immediately
after creating a secondary window, you're querying if the opener is a
pointer reference to the one of its own secondary window. So, that
should always be false.
calWin.opener = this; // reset back to main window
}
This sort of assignment will (soon?) become impossible to do once
browsers tighten their security. Fooling around with pointers like that
shouldn't be possible. E.g.: Mozilla: NS_ERROR_XPC_BAD_CONVERT_JS

alert(calWin.opener.location);
}

(The alerts were added for debugging.) This all works just fine in
IE
it does??

, but when trying from Netscape 7.1 or Mozilla, the calWin.opener is not reset and the alert says the calWin.opener.location is the same as
the calWin.location. Everything I have read about opener says you can
reset it like this
Ok, then. Please show me the links, references, documentation,
preferably official documentations.

, but it doesn't seem to work. Does anyone have any suggestions?

-Diana

Best is to start by provide an url to your page.

DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #2
"DU" <dr*******@hot-R-E-M-O-V-E-mail.com> wrote in message
news:bl*********@news.eusc.inter.net...
<snip>
function changeMonth(month)
{
calWin.open('/cgi-script/calWin'+month,'calWin');

<snip>

It is probably pertinent that this statement has no assignment. If we
assume that a global variable called "calWin" has been assigned a
reference to a pop-up window at this point and the above statement calls
the open method of that window in order to open another window (and I
cannot see any reason for doing that as this window has a perfectly good
wiondow.open function of its own (subject to browser support and content
inserting proxies)), then the window reference for this new pop-up is
just being discarded.

In principal neither calWin nor it's opener will be effected in any way
by this operation and the second pop-up window is inaccessible form
either this window or the first - calWin - pop-up as neither hold a
reference to it.

Richard.
Jul 20 '05 #3
DU
Richard Cornford wrote:
"DU" <dr*******@hot-R-E-M-O-V-E-mail.com> wrote in message
news:bl*********@news.eusc.inter.net...
<snip>
function changeMonth(month)
{
calWin.open('/cgi-script/calWin'+month,'calWin');

<snip>

It is probably pertinent that this statement has no assignment. If we
assume that a global variable called "calWin" has been assigned a
reference to a pop-up window at this point and the above statement calls
the open method of that window in order to open another window


Yes... I totally missed that! Doh!

(and I cannot see any reason for doing that as this window has a perfectly good
wiondow.open function of its own (subject to browser support and content
inserting proxies)), then the window reference for this new pop-up is
just being discarded.

Well, it's a returned value which is never used.
In principal neither calWin nor it's opener will be effected in any way
by this operation and the second pop-up window is inaccessible form
either this window or the first - calWin - pop-up as neither hold a
reference to it.

Richard.


DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #4
I am a bit new at javascript, so I apologize if I seem to not know
what I am doing. Here is a link to the script in question:

http://www.lle.rochester.edu/~dcop/calendarTest.html.

Click on the picture of the calendar to run the script and then click
on one of the arrows to change to a different month. Once you are in
the different month, if you are running in Netscape or Mozilla, it all
stops working.

When I type "javascript:", it says the functions are not defined.
Please note that the debugging alerts are not included in this link.

-Diana
DU <dr*******@hot-R-E-M-O-V-E-mail.com> wrote in message news:<bm**********@news.eusc.inter.net>...
Richard Cornford wrote:
"DU" <dr*******@hot-R-E-M-O-V-E-mail.com> wrote in message
news:bl*********@news.eusc.inter.net...
<snip>
function changeMonth(month)
{
calWin.open('/cgi-script/calWin'+month,'calWin');


<snip>

It is probably pertinent that this statement has no assignment. If we
assume that a global variable called "calWin" has been assigned a
reference to a pop-up window at this point and the above statement calls
the open method of that window in order to open another window


Yes... I totally missed that! Doh!

(and I
cannot see any reason for doing that as this window has a perfectly good
wiondow.open function of its own (subject to browser support and content
inserting proxies)), then the window reference for this new pop-up is
just being discarded.


Well, it's a returned value which is never used.
In principal neither calWin nor it's opener will be effected in any way
by this operation and the second pop-up window is inaccessible form
either this window or the first - calWin - pop-up as neither hold a
reference to it.

Richard.


DU

Jul 20 '05 #5
DU
Diana Coppenbarger wrote:
I am a bit new at javascript, so I apologize if I seem to not know
what I am doing. Here is a link to the script in question:

http://www.lle.rochester.edu/~dcop/calendarTest.html.

File not found!
I had the chance to examine the file though before it went off line. I
am convinced you do not need server-side interaction to create that
[previous or next] month calendar grid. Client-side script will suffice.

The
function changeMonth(month)
should be in the
cgi-script/calWin
file instead of its opener. Accessing that function from the opener just
makes things unneedlessly more complex, I think. Anyway, I'm sure your
interactive date/calendar picker can be made with only client-side script.
Click on the picture of the calendar to run the script and then click
on one of the arrows to change to a different month. Once you are in
the different month, if you are running in Netscape or Mozilla, it all
stops working.

When I type "javascript:", it says the functions are not defined.
Please note that the debugging alerts are not included in this link.

-Diana


DU
--
Javascript and Browser bugs:
http://www10.brinkster.com/doctorunclear/
- Resources, help and tips for Netscape 7.x users and Composer
- Interactive demos on Popup windows, music (audio/midi) in Netscape 7.x
http://www10.brinkster.com/doctorunc...e7Section.html

Jul 20 '05 #6

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

Similar topics

4
by: Yaron C. | last post by:
Hi, I have window A, which open popup A which Open popup C. In the two popups I use a common JavaScript file and in order to distinguish between them I use the following code: if...
2
by: JPL Verhey | last post by:
(i hope somebody (else) will read and have an idea! Thnx) Hi, With a script in a popup window, I want to check if certain content is present in a page loaded into the frame "main" of the...
19
by: Darren | last post by:
I have a page that opens a popup window and within the window, some databse info is submitted and the window closes. It then refreshes the original window using window.opener.location.reload(). ...
1
by: Ray Slakinski | last post by:
Hello, I have defined a function to set an opener for urllib2, this opener defines any proxy and http authentication that is required. If the proxy has authencation itself and requests an...
4
by: Phil Powell | last post by:
I thought this would work but it seems to not work neither in Netscape nor in IE: <script type="text/javascript"> <!-- // OBTAINED FROM http://www.javascripter.net/faq/settinga.htm //...
2
by: TH | last post by:
Hi there What's the best way for a popup to cause an event to fire in the opener? I've got a popup which currently returns a value to the opener by setting a hidden input in the opener: ...
5
by: asadhkhan | last post by:
I have the following code which works correctly in IE 6, but in IE 7, Fire Fox 2.0 and Netscape 8 it does not work. I have a main page where a button calls this pop-up and uploads a file once you...
4
by: gubbachchi | last post by:
Hi all, Please anybody help me solve this problem. I am stuck up with this from past 2 weeks. I am developing an application where, when the user selects date from javascript datepicker and enters...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.