我一直试图让下面的比较运算符工作。第二个'if'总是执行代码中的下一个语句。我要的是能够检测到何时eith entryType或followupEntryType不等于字符串“长期护理保险”这里是代码...Javascript不是(a == b)||不(c == b)
function getComboB(sel) {
var value = sel.options[sel.selectedIndex].value;
if (value == "Rehab") {
if (!(document.getElementById('entryType').value == "Long Term Care") || !(document.getElementById('followupEntryType').value == "Long Term Care")) {
document.getElementById('followupEntryType').value = "Long Term Care";
alert("short-term rehab code");
return true;
} else {
alert("long-term rehab code");
return true;
}
}
}
你的意思是'&&'而不是'||'? – 2013-03-16 19:20:19
顺便说一下,不缩进是花费太多时间试图查看代码无法工作的一种肯定方式。 – 2013-03-16 19:20:41
用[this]重新格式化你的代码(http://jsbeautifier.org/) – 2013-03-16 19:21:23