为什么这个简单的 JavaScript 验证不起作用?第一个条件通过但第二个条件没有通过??
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function process(){
var val = document.getElementById('usrIN').value;
var uppVer = val.toUpperCase();
if(val == "" || val == NULL){
alert ("Must fill in input");
}else if (val !== uppVer){
alert("Must be upper case");
}
}
</script>
</head>
<body>
<form type="post" id="frmMain" />
<p>Insert name in upper case <input type="text" maxlength="25" id="usrIN"/></p>
<a href="#" onClick="process();"> <img src="button.jpeg" ></a>
</form>
</body>