zoukankan      html  css  js  c++  java
  • 当页面信息填写不完整,点击提交后,直接跳转到未填写位置

    <li>
      <span><em>*</em>联系人邮箱</span>
      <input class="input_mail input" name="email[]" required id="cyf_input_mail" type="text" placeholder="邮箱" />
      <u class="spa spa14"></u>
    </li>

    <input class="input2" type="button" id="submit1"  value="提交" />
    /**失焦提示**/
    $(function(){
      $(".input").blur(function(){
        $(".spa").css("color","#ff0000")
        if($(this).is("#cyf_input_mail")){
             var cyf_input_mail=$("#cyf_input_mail").val();
              var reg = /^w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*$/;
              if(cyf_input_mail == undefined || cyf_input_mail == "") {
                $(".spa11").text("请填写联系人邮箱");
            $(this).css("border","1px solid #ff0000")
              }else if(!reg.test(cyf_input_mail)){
                  $(".spa11").text("请填写真实有效的邮箱地址");
              }else{
                  $(".spa11").text("");
                  $(this).css("border","1px solid #dbdbdb")
              }
           }
      })
    })
    /**聚焦提示**/
    $(".input").focus(function(){
      if($(this).is("#cyf_input_mail")){
        $(".spa11").text("请填写真实有效的常用邮箱地址").css("color","#aaa")
          $(this).css("border","1px solid #aaa")
       }
    })
    /**提交判断**/
    function checked(){
      reg = /^w+([-+.]w+)*@w+([-.]w+)*.w+([-.]w+)*$/;
       if($("#cyf_input_mail").val()==""){
         $(".spa14").text('请填写联系人邮箱');
          $("#cyf_input_mail").focus();
          $(".spa").css("color","#ff0000");
          return false;
       }else if(!reg.test($("#cyf_input_mail").val())){
         $(".spa14").text("请填写真实有效的邮箱地址");
          $("#cyf_input_mail").focus();
          $(".spa").css("color","#ff0000");
          return false;
        } else{
           $(".spa14").text('');
        }
        return true;
    }
    $("#submit1").click(function(){
      $(".spa").css("color","#ff0000");
       $(".input").css("border","1px solid ff0000");
        if(checked()){
          $("#cyf_form").submit();
        }
    })
  • 相关阅读:
    微软O365使用教程:如何邀请客户试用
    Using the ForeFront Identity Manager to Configure SharePoint 2010’s User Profile Sync Service
    SharePoint2010文档归档策略
    转发:SP 2010: Find error messages with a Correlation ID token in SharePoint 2010
    用sql server的脚本导入Excel2010或Excel2013格式数据
    sharepoint2010的调查的问题总结
    暑假第一周进度报告
    暑假第四周进度报告
    暑假第三周学习进度报告
    暑假第二周进度报告
  • 原文地址:https://www.cnblogs.com/zhangjianzhen/p/9844980.html
Copyright © 2011-2022 走看看