我的网站上有一个文本框,用户可以输入命令.但问题是命令区分大小写.如何使命令不区分大小写?这是我的代码:
JavaScript的:
function showAlert() {
var txtCtrl = document.getElementById("textbox1");
var txtVal = txtCtrl.value;
if (txtVal == '') {
alert('Please fill in the text box. For a list of commands type "Help" into the text box.');
}else if (txtVal == 'Start' || txtVal == 'start') {
alert('Hello. What would you like me to do?');
}else if (txtVal === 'Weather' || txtVal === 'weather') {
window.location = "https://www.google.com/#q=weather";
}else if (txtVal === 'Time' || txtVal === 'time') {
alert('The current time according …Run Code Online (Sandbox Code Playgroud) javascript ×1