Yes thats what clicked me after posting that at a time one of the
first elseif or second elseif has to be true and in either cases Else
will never be executed.Anewayz thanks for replying.
wrote:
> divya wrote:
> > if (document.form1.txtbookedby.value == "")
> > {
> > alert('your name field cannot be empty');
> > }
> > else if (document.form1.txtContact.value == "")
> > {
> > alert('The extension number field cannot be empty');
> > }
> > else if (document.form1.txtContact.value != "")
> > {
>
> [...]
>
> > }
> > else
> > {
> > alert("hey youve filled alll the fields correct ");
>
> [...]
>
> > }
>
> > When I remove the coments ,it properly checks the first
> > three conditions and gives respective alert boxes when
> > the conditions are true.But when all the 3 conditions are
> > false (that is conditions given in the if ,1st elseif and
> > 2nd elseif )...
>
> You're mistaken. 'A or not A' can't *ever* be false (if you
> stick to binary logic, of course). The condition in the
> second else if is a negation of a condition in the first
> else if. They can't both be false at the same time.
>
> --
> Pavel Lepin