js邮箱正则表达式的使用-原生用法

在网页中插入邮箱输入框,当邮箱输入格式错误,给出提示。
代码:

function wwwz88jcom(){
    var t  = /^[A-Za-zd0-9]+([-_.][A-Za-zd]+)*@([A-Za-zd]+[-.])+[A-Za-zd]{2,5}$/;
    var y=document.getElementById("y");
    if(!(t.test(y.value)))
    {
        var txt=document.getElementById("txt_5");        
        txt.innerText="邮箱格式不正确!";
    }else{
        var txt=document.getElementById("txt_5");
        txt.innerText="";
    }
    }

原创文章,作者:星辰,如若转载,请注明出处:http://www.z88j.com/426.html

(4)
打赏 微信扫一扫 微信扫一扫
上一篇 2021年8月28日 下午11:49
下一篇 2021年9月15日 下午2:26

相关推荐

发表回复

登录后才能评论

Warning: error_log(/www/wwwroot/www.z88j.com/wp-content/plugins/spider-analyser/#log/log-1917.txt): failed to open stream: No such file or directory in /www/wwwroot/www.z88j.com/wp-content/plugins/spider-analyser/spider.class.php on line 2900