如何在JavaScript中的if语句中指定多个条件 [英] How to specify multiple conditions in an if statement in javascript
本文介绍了如何在JavaScript中的if语句中指定多个条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这就是我提到这两个的两个条件
Here is how I mention two conditions if this or this
if (Type == 2 && PageCount == 0) || (Type == 2 && PageCount == '')
PageCount= document.getElementById('<%=hfPageCount.ClientID %>').value;
}
推荐答案
只需将它们添加在if语句的主括号内,例如
just add them within the main bracket of the if statement like
if ((Type == 2 && PageCount == 0) || (Type == 2 && PageCount == '')) {
PageCount= document.getElementById('<%=hfPageCount.ClientID %>').value;
}
从逻辑上讲,这也可以用更好的方式重写! 这具有完全相同的含义
Logically this can be rewritten in a better way too! This has exactly the same meaning
if (Type == 2 && (PageCount == 0 || PageCount == '')) {
这篇关于如何在JavaScript中的if语句中指定多个条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文