[thelist] Javascript if...or statement

Cymbala, Greg Greg.Cymbala at Den.Galileo.com
Fri Aug 30 11:24:00 CDT 2002


These are <select> elements?  I wouldn't recommend using the value property
for them, unless your audience is IE-only.  I don't think it'll work in most
4.x and below versions of Netscape.

You just need to make sure at least one is selected from?  And it's OK if
both are selected?  Then try:

function checksubmit()
{
      if (document.Job.VersionType.selectedIndex > 0 ||
	  document.Job.LFproduct.selectedIndex > 0)
   {
      alert("Please select a Version or Plug-In")
      // Note: do you mean document.Form or document.Job?
      document.Form.VersionType.focus();
      return false;
   }
   return true;
}

Or you could do something silly like

var selected = document.Job.VersionType.selectedIndex +
document.Job.LFproduct.selectedIndex;

if (selected <= 0) {
      alert("Please select a Version or Plug-In")
      // Note: do you mean document.Form or document.Job?
      document.Form.VersionType.focus();
      return false;
}

Note that the code above assumes that your <select>'s first item is
something like "Please select one".

HTH,
Greg


The information in this electronic mail message is sender's business
Confidential and may be legally privileged.  It is intended solely for the
addressee(s).  Access to this Internet electronic mail message by anyone
else is unauthorized.  If you are not the intended recipient, any
disclosure, copying, distribution or any action taken or omitted to be taken
in reliance on it is prohibited and may be unlawful.
The sender believes that this E-mail and any attachments were free of any
virus, worm, Trojan horse, and/or malicious code when sent. This message and
its attachments could have been infected during  transmission. By reading
the message and opening any attachments, the recipient accepts full
responsibility for taking protective and remedial action about viruses and
other defects. Galileo International is not liable for any loss or damage
arising in any way from this message or its attachments.





More information about the thelist mailing list