Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if statement

Status
Not open for further replies.

andycape

Programmer
Aug 22, 2003
177
ZA
I want to write an if statement to say if a certain value is over 0 then i need to check if two other values exist, and if they do not i need to prompt the user.

It sounds easy but I'm quite new to this :)

somewhere along the lines of :


function checkForm(form) {

if (form.Min.value > 0) {
if (form.Value1.value == "") {
if (form.Value2.value == "") {
alert ("\nYou must select Value1 or Value2.")
}
}
return false;
}

else return true;
}


any ideas ? thanx
 
Try this as a short replacement:

Code:
function checkForm(form)
{
  if ((form.Min.value - 0) <= 0 && form.Value1.value == "" && form.Value2.value == "") return false;
  return true;
}

Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top