[Javascript] Re:"To be or Not to be" an Object

Bill Marriott bill.marriott at optusnet.com.au
Wed Jul 4 07:08:57 CDT 2001


Hi again,
I'm trying to use the following function

function ClosePop()
{
   alert (ReportPick);
  alert (cropcheckHelp);

   If (typeof(ReportPick) != "undefined")
      {
          If (ReportPick.closed == false)
              {
                   ReportPick.close();
              }
      }

   If (typeof(cropcheckHelp) != "undefined")
      {
            If (cropcheckHelp.closed == false)
                {
                     cropcheckHelp.close();
                }
        }
}

to close pop up windows and am calling the code
from the onunload event in the body. <BODY LANGUAGE=Javascript
onunload="return ClosePop()">
I put the 2 alerts in because the code errors at

   If (typeof(ReportPick) != "undefined")

and says it is not an object. The 2 alerts say it is an object.

The 2 popups both work, created using
ReportPick = window.open(src,"","SCROLLBARS=YES,RESIZABLE=YES,
WIDTH=220,HEIGHT=100,LEFT=450,TOP=50");

The 2 popup names are both declared outside functions in the first lines of
the script tag.

 var ReportPick;
 var cropcheckHelp;

Does anyone know what is going on?
Thanks in advance

Bill   (Oh! why didn't I stay working with MS Access)







More information about the Javascript mailing list