jsp如何验证用户信息

 时间:2024-10-13 16:12:31

1、首先写一个form表单,里面的信息如下:<form method="post" id="form&鳎溻趄酃quot; action="xxx" onsubmi="return check_form()">用户名字:<input type="text" name="username" value=""><br>用户密码:<input type="password" name="password1" value=""><br>再次确认密码:<input type="text" name="password2" value=""><br>用户手机号:<input type="text" name="tel" value=""><br>用户身份证:<input type="text" name="idno" value=""><br>用户邮箱:<input type="text" name="mail" value=""><br><input type="submit" value="提交"><input type="reset" value="重置"></form>

jsp如何验证用户信息

3、判断身份证格式是否正确(用到了js里面的正则表达式)<script>functioncheck_form(){//获得表单的id var f=document.getElementById("form");//判断身份证的格式if(!/^\d{6}(18|19|20)?\d{2}(0[1-9]|1[12])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$/i.test(f.idno.value)){ alert("身份证号格式错误"); return false; }}</script>

jsp如何验证用户信息

5、//判断用户两次输入的密码是否一致<script>functioncheck_form(){//获得表单的id var f=document.getElementById("form");//判断两次输入的密码是否一致if(f.password1.value!=f.password2.value){ alert("两次输入的密码不一样,请重新输入!"); return false; }}</script>

jsp如何验证用户信息
  • 如何快速计算出给定数组中的最小值
  • AxureRP如何设置单选按钮唯一选中
  • 如何用MATLAB进行高通FIR滤波器仿真
  • Starting Tomcat Server at localhost failed
  • jquery如何给a标签添加下划线
  • 热门搜索
    高清性色生活片97 kh是什么意思 花瑶花护肤品怎么样 5月20日是什么星座 贴息是什么意思 behind是什么意思 如何考取会计证 如何知道自己的星座 如何自学韩语 平年和闰年怎么算