Cami

"null" and "" are not the same thing in JavaScript.

How about something like

function twoTheSame(one, two, three)
{
 if(((one == two)   && (one != null) && (one != "undefined") && (one != ""))
||
    ((one == three) && (one != null) && (one != "undefined") && (one != ""))
||
    ((two == three) && (two != null) && (two != "undefined") && (two !=
""))) {
   return true;
 } else {
   return false;
 }
}

function popup( pageToLoad, winName, width, height) 
{ 
 if (twoTheSame(document.updatefav.myselectbox.value,
               document.updatefav.myselectbox1.value,
               document.updatefav.myselectbox1.value)) {
  xposition=200; yposition=300; width=250; height=90
     args = "width=" + width + "," + "height=" + height + "," +
  "location=0," + "menubar=0," + "resizable=1," + "scrollbars=0," +
  "status=0," + "titlebar=0," + "toolbar=0," + "hotkeys=0," + "screenx=" +
  xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + ","
+
  "top=" + yposition;
     window.open( "processed.htm","popup_win",args );
  return false;
 } else {
  return true;
 }
}

Nick
-----Original Message-----
From: Cami Lawson [mailto:[EMAIL PROTECTED]]
Sent: Monday, January 15, 2001 3:30 PM
To: CF-Talk
Subject: Javascript on selectboxes


I have this script that is called when a form is submitted.  It is supposed
to display a popup window if two of the three selectboxes are the same.  It
works good except that if the first box is selected and the other two are
null or empty then the popup appears.  Same thing happens with the second
box selected and the first and third null or emtpy, and the same with the
third box.  Otherwise it works great with two boxes selected that might be
the same.  Any ideas on where I have gone wrong with this one?

TIA,

cami

function popup( pageToLoad, winName, width, height) 
{ 
if ((document.updatefav.myselectbox.value ==
document.updatefav.myselectbox1.value) ||
      (document.updatefav.myselectbox.value ==
document.updatefav.myselectbox2.value) ||
      (document.updatefav.myselectbox1.value ==
document.updatefav.myselectbox2.value)) 
  { if ((document.updatefav.myselectbox.value == null) &&
(document.updatefav.myselectbox1.value  == null))
   {return true;}
    else if
        ((document.updatefav.myselectbox.value == null) &&
(document.updatefav.myselectbox2.value == null)) 
     {return true;}
    else if
     ((document.updatefav.myselectbox1.value == "") &&
(document.updatefav.myselectbox2.value == ""))
     {return true;}
    else
  {
  xposition=200; yposition=300; width=250; height=90
     args = "width=" + width + "," + "height=" + height + "," +
  "location=0," + "menubar=0," + "resizable=1," + "scrollbars=0," +
  "status=0," + "titlebar=0," + "toolbar=0," + "hotkeys=0," + "screenx=" +
  xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + ","
+
  "top=" + yposition;
     window.open( "processed.htm","popup_win",args );

  return false;}
 
}}


**********************************************************************
Information in this email is confidential and may be privileged.
It is intended for the addressee only. If you have received it in error,
please notify the sender immediately and delete it from your system. 
You should not otherwise copy it, retransmit it or use or disclose its
contents to anyone. 
Thank you for your co-operation.
**********************************************************************

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to