空格检查

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script>
function yz(){
var m=document.getElementsByTagName("input");
for(var i=0;i<m.length;i++)
{
if(m[i].value==""||m[i].value==null)
{
alert("请填写所有的空格!");
return false;
}
}
alert("成功!");
}
</script>
</head>
<body>
<input type="text">
<input type="text" />
<input type="text" />
<input type="text" />
<a href="#" onclick="yz()">提交</a>
</body>
</html>

原文地址:https://www.cnblogs.com/DixinFan/p/9509356.html