mnongkhlaw
Programmer
I want to detect if dates entered by users in a textbox contains JAN,FEB,MAR etc :
For example, when theInput="1/OCT/99" the first alertbox gives me theChar=OCT, but the second alertbox still gives me goodDate=false when I expect it to be true.
What's wrong with the above code?
Mark
Code:
var goodDate = true;
var theChar = theInput.substring(2,5); //see theInput below
if (theChar != "JAN" || theChar != "FEB" || theChar != "MAR" || theChar != "APR" || theChar != "MAY" || theChar != "JUN" || theChar != "JUL" || theChar != "AUG" || theChar != "SEP" || theChar != "OCT" || theChar != "NOV" || theChar != "DEC"){
goodDate = false;
alert("theChar= "+theChar);
alert("goodDate= "+goodDate);
}
For example, when theInput="1/OCT/99" the first alertbox gives me theChar=OCT, but the second alertbox still gives me goodDate=false when I expect it to be true.
What's wrong with the above code?
Mark