RE: Need help with Confirm Method
by Jim Coffield <coffield(at)cet.edu>
|
Date: |
Fri, 2 Jun 2000 19:18:01 -0500 |
To: |
Wise Lisa M Civ 355 TRS/RTS <Lisa.Wise(at)dm.af.mil>, hwg-languages(at)hwg.org |
In-Reply-To: |
af |
|
todo: View
Thread,
Original
|
|
I see one possible problem. Below Rossi Designs stated that
opener.variablename="new value" should work and as far as that is true
(never tried with child windows but have checked variable values across
frames). In your code however, you have:
opener.document.flag2=1;
This is setting the value of a property within the document object. As far
as I know, if you want to use this format you must declare the variable
(property) as:
document.flag2=0;
-----
If you use the normal variable declaration:
var flag=0;
then access the variable with:
opener.flag2=1;
------
Good Luck (I've pulled out a few chunks of hair on this one with some of my
pages)
Jim
> -----Original Message-----
> From: Rossi Designs
>[mailto:webmaster(at)rossidesigns.net]
> Sent: Thursday, June 01, 2000 8:00 PM
> To: Wise Lisa M Civ 355 TRS/RTS;
>hwg-languages(at)hwg.org
> Subject: Re: Need help with Confirm Method
>
>
> Who told you that?
>
> opener.variablename = "new value";
>
> Rossi Designs
>
> ----- Original Message -----
> From: Wise Lisa M Civ 355 TRS/RTS
><Lisa.Wise(at)dm.af.mil>
> To: <hwg-languages(at)hwg.org>
> Sent: Thursday, June 01, 2000 7:22 PM
> Subject: RE: Need help with Confirm Method
>
>
> | Never mind,I've been informed that a child
>window can't update a variable in
> | a parent window.
> |
> | So I'm going another route.
> |
>
>JIM,
>
>
>I'VE SENT THE MESSAGE BELOW OUT TWICE TODAY IN RESPONSE TO ROSSI. I DIDN'T
>RECEIVE ANY RESPONSES, SO I'M NOT SURE IF ANYONE SAW IT. ALSO, BELOW IS
>YESTERDAY'S MESSAGE WITH THE ORIGINAL CODE I WAS TRYING TO MAKE WORK
>
>
>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>A co-worker, whose knowledge is greater than mine, told me that he'd tried
>it previously and found that it (updating a variable in the parent window
>from a child window)wouldn't work. I tried it and it seemed that the
>variable was not updating. The confirm box always popped up as if I hadn't
>chosen all options - even when I had.
>
>Was it something else I messed up?
>
>The new route I've chosen doesn't work either - because I've chosen to check
>if the image.src changed to the checkmark image - but I put in a relative
>path ../images/checkmark.gif and by putting up an alert box I've learned
>that the browser reads the full path which right now starts at my harddrive
>(it'll change so I can't put the full path name in). It seems that it'd be
>easier to find a work-around for this than figuring out why my variable flag
>doesn't update. Any ideas??
>
>CODE IN QUESTION: ------------------------------
>//confirmation to continue without seeing all sections Wise Jun 2000
>function question() { alert(document.energyCheck.src);
> if ((document.energyCheck.src !="../images/checkmark.gif") ||
>(document.stallCheck.src !="../images/checkmark.gif")) {
> if(confirm("You have not selected all options on this page. Are you
>sure you want to continue?")){
> window.location="G11.html";
> }
> else {
> return false;
> }
> }
>else {
> window.location="G11.html";
> }
>}
>
>---------------------------------------------------------
>Thanks again.
>***********************************************************
>Lisa Wise
>**********************************************************
>
>
>
>
>YESTERDAY'S QUESTION - ABOUT CHILD AND PARENT WINDOWS.
>
>>I have another newbie question. I've never done a confirm box before, and
>I thought this would work (in theory at least). What happens, though, is
>that the variables flag1 and flag2 don't seem to be updated by the children
>pages like they're supposed to, the confirm box pops up even though they
>should be turned to 1 by the children pages.
>
>Also, I don't understand the return false part completely, but copied it
>from another type of script because I didn't know what else to put if they
>click on "Cancel". The way it is, if they click Cancel, a white page with
>the word "false" appears ????????? If they click OK, it does correctly load
>the next page.
>
>I've probably made some simple error, but I can't figure it out and would
>appreciate more eyes on it.
>
>TIA,
>Lisa Wise
>
>
>Script on the parent page that runs when they click an arrow image:
>
>***********************************************************************
>//confirmation to continue without seeing all sections
>var flag1=0;
>var flag2=0;
>
>function question() {
> if (flag1 == 0 || flag2 == 0) {
> if(confirm("You have not selected all options on this page. Are you
>sure you want to continue?")){
> window.location="G11.html";
> }
> else {
> return false;
> }
> }
>else {
> window.location="G11.html";
> }
>}
>
>************************************************************************
>
>Script on the child page that should update the variables on the parent
>page. I know the basic concept works,because the image source on the parent
>page IS updated by this.
>
>***********************************************************************
>
>function updateParent(){
> opener.document.energyCheck.src="../images/checkmark.gif";
> opener.document.flag2=1;
> }
>
>***********************************************************************
James E. Coffield, Ph.D.
Research Associate
Center for Educational Technologies/
NASA Classroom of the Future
Wheeling Jesuit University
316 Washington Avenue
Wheeling, WV 26003
Phone (304) 243-2469 Fax: 304-243-2497
WWW address: http://www.cet.edu/
email: coffield(at)cet.edu
HWG: hwg-languages mailing list archives,
maintained by Webmasters @ IWA