from 表单多文本提交不为空

假设需要提交4个文本,均不为空;

<form id="form" onsubmit="return check()">

</form>

js中建立方法

 1 script type="application/javascript" >
 2 
 3     function check(){
 4         var name = document.getElementById("form");
 5         for(var i=0;i<4;i++)      //4,表示文本数目
 6         {
 7             if(name[i].value == "")
 8             {
 9                 alert("文本不能为空!");
10                 return false;
11         }
12         }
13 
14 
15 
16 
17     }
18     
19 </script>
原文地址:https://www.cnblogs.com/wanlibingfeng/p/6837226.html