标签:style blog color io os java for sp div
<script type="text/javascript"> function checkForm(form) { if (form.name.value == "") { alert("姓名不能为空!"); return false; } if (form.password.value.length < 6||form.password.value.length > 13) { alert("密码长度应在6-13之间!"); return false; } if (form.age.value<0||form.age.value>120) { alert("请输入正确的年龄!"); return false; } if (form.email.value.match(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)==null) { alert("请输入正确的邮箱!"); return false; } } </script>
form表单<form action="regist.do" method="post" onsubmit="return checkForm(this)" name="form">
中input标签里面name对应(name password age(int) email)即可 比如:<input type="text" class="inputgri" name="email" />
标签:style blog color io os java for sp div
原文地址:http://www.cnblogs.com/manusas/p/4013534.html