我試圖讓jQuery中的動作運行,如果任2個參數滿足jQuery的或邏輯錯誤只能在運行的一半或聲明
如果選擇umodt =「終止」或「刪除」
然而,我的邏輯是隻有射擊時= 「刪除」 - 請幫助
$(document).ready(function() {
$("#umodt select").change(function (e) {
if ($(this).val() != "Terminate", $(this).val() != "Delete") {
$("#disreas").hide();
}
else {
$("#disreas").show();
}
});
});
HTML引用:
<div id="acttype"><table bgcolor="#CCCCFF" bordercolor="#000000" border="1" width="700"><tr><td colspan="6" align="center" border="1">Search Data: <input type="text" name="data"> Search by: <select id="acttype" name="acttype"><option value=" "> </option><option value="Last Name">Last Name</option><option value="First Name">First Name</option><option value="Email">E-mail</option><option value="SSN">SSN</option><option value="Reset">Reset Conditions</option></select> </td></tr></table></div><div id="umodt"><table bgcolor="#CCCCFF" bordercolor="#000000" width="700" border="1"><tr><td colspan="6" align="center" border="1"> Or Select Action: <select id="umodt" name="umodt"><option value=" "> </option><option value="View">View Employee</option><option value="Add">Add Employee</option><option value="Edit">Edit Employee</option><option value="Delete">Delete Employee</option><option value="Terminate">Terminate Employee</option><option value="Sendemail">Send Message</option></select></td></tr></table></div><div id="emails"><table bgcolor="#CCCCFF" bordercolor="#000000" width="700" border="1"><tr><td colspan="2" align="center" border="1"> Enter Subject: </td><td colspan="8" align="center" border="1"> <input type="text" name="sub" size="90"></td></tr><tr><td colspan="2" align="center" border="1">Enter Content: </td><td colspan="8" align="center" border="1"> <textarea name="content" rows="7" cols="68"></textarea></td></tr></table></div><div id="disreas"><table bgcolor="#CCCCFF" bordercolor="#000000" width="700" border="1"><tr><td colspan="2" align="center" border="1"> Enter Reason: </td><td colspan="8" align="center" border="1"> <input type="text" name="reason" size="90"></td></tr></table></div><table bgcolor="#CCCCFF" bordercolor="#000000" width="700"><tr><td colspan="10" align="center" ><input type="submit" name="submit" value="Submit"></td></tr></table>
使用||而不是逗號 – Mark