有人可以帮助改变它,以包含一个名为BUTTON1.JPG而不是标准submit按钮的图像?
<form id='formName' name='formName' onsubmit='redirect();return false;'>
<div class="style7">
<input type='text' id='userInput' name='userInput' value=''>
<input type='submit' name='submit' value='Submit'>
</div>
</form>
Run Code Online (Sandbox Code Playgroud) 可能重复:
交换机案例中的JavaScript或表达式
case 'att':
window.location.replace('/att-Forms.htm');
break;
case 'at&t':
window.location.replace('/att-Forms.htm');
break;
Run Code Online (Sandbox Code Playgroud)
有没有办法用某种"或"功能来缩短它?
<script type='text/javascript'>
function redirect() {
var input = document.getElementById('userInput').value;
switch(input) {
case 'ALCOA':
window.location.replace('alcoa-Forms.htm');
break;
case 'alcoa':
window.location.replace('/alcoa-Forms.htm');
break;
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能让这个函数不区分大小写,所以我只能写一次?