为什么这不能正常工作?
无论您输入什么值,它总是返回“无效的票证类型”
function start() {
var TickType;
TickType = document.getElementById("TicketType").value;
TickType = String(TickType);
var TicketQty = document.getElementById("TicketQty").value;
if (TickType != "A" || TickType != "B" || TickType != "C") {
document.getElementById("msg").innerHTML = "Invalid Ticket Type";
}
if (isNaN(TicketQty)) {
document.getElementById("msg").innerHTML = "Non numeric qty has been entered";
}
if (TicketQty < 1 || TicketQty > 100) {
document.getElementById("msg").innerHTML = "Qty is outside valid range";
}
}
<h1>Ticket Sales</h1>
<p>Enter the ticket type (A, B or C)</p>
<input type="text" id="TicketType">
<p>Enter the quantity required (1-100)</p>
<input type="text" id="TicketQty">
<p>
</br>
</p>
<button onclick="start()">Click me</button>
<p id="msg"></p>