首页 > 代码库 > js 表单验证
js 表单验证
function one() {var group = document.getElementById("group").value;if(group == ""){alert("分组不能为空"); return false;}var ss = document.getElementById("ss").value;if(ss == ""){alert("城市不能为空"); return false;}var sss = document.getElementById("sss").value;if(sss == ""){alert("县区不能为空"); return false;}}function two(){var name = document.getElementById("name").value;if(name == ""){alert("名字不能为空"); return false;}var psw = document.getElementById("psw").value;if(psw == ""){alert("密码不能为空"); return false;}var number = document.getElementById("number").value;if(number == ""){alert("手机号不能为空"); return false;}var groups = document.getElementById("groups").value;if(groups == ""){alert("分组不能为空"); return false;}var gss = document.getElementById("gss").value;if(gss == ""){alert("城市不能为空"); return false;}var gsss = document.getElementById("gsss").value;if(gsss == ""){alert("县区不能为空"); return false;}}function three(){var upname = document.getElementById("upname").value;if(upname == ""){alert("名字不能为空"); return false;}var uppsw = document.getElementById("uppsw").value;if(uppsw == ""){alert("密码不能为空"); return false;}var upnumber = document.getElementById("upnumber").value;if(upnumber == ""){alert("手机号不能为空"); return false;}var upgroup = document.getElementById("upgroup").value;if(upgroup == ""){alert("分组不能为空"); return false;}var upss = document.getElementById("upss").value;if(upss == ""){alert("城市不能为空"); return false;}var upsss = document.getElementById("upsss").value;if(upsss == ""){alert("县区不能为空"); return false;}}
<form action="pup.php" method="post" onsubmit="return three()">
以此类推
js 表单验证
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。