jd2007 Posted August 13, 2007 Share Posted August 13, 2007 var x=2; var y=3; if ((x==3)&&(y==3)) { alert("Success !"); } else { alert("Failure."); } the above checks if x is equal to three and y is equal to three or not. if one of the conditions return false, the whole thing returns. how do i check which condition returns false ? Quote Link to comment Share on other sites More sharing options...
php_tom Posted August 13, 2007 Share Posted August 13, 2007 How about: var x=2; var y=3; if ((x==3)&&(y==3)) alert("Success !"); else { if(x==3) alert("y wasn't 3"); elseif(y==3) alert("x wasn't 3"); else alert("both x and y weren't 3"); } Is this what you wanted? Quote Link to comment Share on other sites More sharing options...
jd2007 Posted August 13, 2007 Author Share Posted August 13, 2007 yes...i can do that...i want a shorter way.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.