views:

448

answers:

0

If I have this method:

this.getForm = function ()
{
 try
 {
  var frmIndex = arguments[0];
  if (isNaN(frmIndex)) frmIndex = 1;
  if (window !== null)
  {
   if (window.opener !== null)
   {
    return window.parent;
   }
   else if (window.parent !== null)
   {
    if (window.parent.frames !== null)
    {
     if (window.parent.frames(frmIndex) !== null)
     {
      return window.parent.frames(frmIndex);
     }
    }
   }
  }
 }
 catch(e)
 {
  return null;
 }
 return null;
};

I know that 'undefined' is a type, and null is an object used to represent 'no value'. I need to verify that some form elements exist. So it will be O.K. to compare window.XXX objects like:

if (window.opener !== null)

or

if (window.opener != undefined)