• html5表单验证消息框




    <!DOCTYPE html>
    <html>
        <head>
            <title>TODO supply a title</title>
            <meta charset="UTF-8">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            
            <style>
                .emailerr{
                     150px;
                    height: 26px;
                    border: 1px solid red;
                    font-size: 12px;
                    color: red;
                    text-align: center;
                    background-color: white;
                    line-height: 26px;
                    position: absolute;
                    left: 220px;
                    top:6px;
                }
                .emailerr:before,.emailerr:after{
                    content: "";
                     0px;
                    height: 0px;
                    border: 6px transparent solid;
                    position: absolute;
                    display: block;
                }
                .emailerr:before{
                    top: 6px;
                    left: -13px;
                    border-right-color: red;
                    z-index: 0;
                }
                .emailerr:after{
                    top: 6px;
                    left:-12px;
                    border-right-color: white;
                    z-index: 1;
                }
            </style>
            <script>
                
                function email2(){
                    var email=document.getElementById("email");
                    var emailerr=document.getElementById("emailerr");
                    if(email.value==""){
                        emailerr.style.display="block";
                        emailerr.style.color="red";
                        emailerr.innerHTML="邮箱不能为空";
                    }else if(!email.checkValidity()){
                        emailerr.style.display="block";
                        emailerr.style.color="red";
                        emailerr.innerHTML="请输入有效的邮箱";
                    }else{
                        emailerr.style.displey="block";
                        emailerr.style.color="green";
                        emailerr.innerHTML="邮箱认证通过";
                    }
                }
            </script>
        </head>
        <body>
            <form novalidate="true">
                <label for="email">Email</label>
                <input type="email" id="email" name="email" onblur="email2()"><div id="emailerr" class="emailerr" style="display: none;"></div><br><br>
                <input type="submit" onclick="email2()">
            </form>
        </body>
    </html>
    
  • 相关阅读:
    virtual private catalog
    About Health Monitor Checks
    修改ORACLE-NLS_DATE_FORMAT时间格式的四种方式
    About Quick Packaging and Custom Packaging
    Fault Diagnosability Infrastructure Overview
    Basic Concepts of Block Media Recovery
    破解:前一刻觉得还有好多事要做,突然间就不知道该干什么了
    利用OSG实现模拟飞机尾迹-粒子系统
    解决电脑上PPT频繁刷新的问题
    如何查看自己电脑系统的安装日期-Window上
  • 原文地址:https://www.cnblogs.com/zgl-x/p/5663014.html
Copyright © 2020-2023  润新知