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标签添加下划线
  • 热门搜索
    洪泽旅游 上海免费的旅游景点 旅游产品有哪些 文昌旅游攻略 廊坊旅游景点 查干湖旅游攻略 冰岛旅游多少钱 坝上旅游 11月份去哪里旅游好 途牛网旅游网