• 验证错误时:

jsp页面前端加入验证,光标离开验证

  • 验证正确时:

jsp页面前端加入验证,光标离开验证

  • jsp页面前段代码:

   <input type="text" onblur="code()" placeholder="请输入部门编号" ></span>

  • js事件触发代码

  function code(){
      var reg=/^\d{6}$/;
      var dept_code=$("#dept_code").val();
      if(dept_code==null || dept_code==""){
          {document.getElementById('pa').innerHTML='<font color="green"></font>' }
      }
      else if(reg.test(dept_code))
      {document.getElementById('pa').innerHTML='<font color="green">请继续输入。。。</font>' }
      else
      {document.getElementById('pa').innerHTML='<font color="red">部门编号规定为六位数字!</font>'}
      }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2021-09-23
  • 2022-12-23
  • 2021-11-12
  • 2022-01-10
猜你喜欢
  • 2021-11-17
  • 2021-04-30
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2021-11-30
  • 2021-11-30
相关资源
相似解决方案