200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > jquery中邮箱地址 URL网站地址正则验证实例代码【jquery】

jquery中邮箱地址 URL网站地址正则验证实例代码【jquery】

时间:2022-02-16 22:34:50

相关推荐

jquery中邮箱地址 URL网站地址正则验证实例代码【jquery】

web前端|js教程

邮箱地址,URL地址,正则

web前端-js教程

email地址验证

114la导航网站源码,安装ubuntu免硬盘,爬虫表情包大全,php edition,金融公司seolzw

function checkEmail(){

var email=$.trim($("#report_email").val());

if(email == ""){

$("#report_email").next(p).html("*请输入邮箱地址!");

return false;

}

var re = /^([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+.[a-zA-Z]{2,3}$/ig;

if(!re.test(email)){

$("#report_email").next(p).html("*邮箱地址格式错误!");

return false;

}

return true;

}

url地址验证

云豹直播客户端源码,nam下载 ubuntu,如何将tomcat扩容,网络爬虫神器,php是不是 解释性语言,网络优化推广公司机构seo教程lzw

function getUrlArray(e, type){

var urls = $.trim($("#report_url_list").val());

urls = urls.replace(/s*n+s*/ig,"n");

$("#report_url_list").val(urls);

//format the urls

if(type == "blur"){

reportUrlElm.val(urls);

}

if(e && e.keyCode == 13){

reportUrlElm.val(urls + "n");

}

主题酒店预定网站源码,ubuntu pe工具下载,tomcat启动连接池过程,vps挂爬虫,php精通需要多少钱,鼎湖seo推广lzw

urls = urls.split("n");

user_urls = urls;

return urls;

}

function checkurls(e, type) {

$("#errorList").find("span").hide();

urls = getUrlArray(e, type);

var urlfag = true;

url_index = 0;

var urlText="请填写举报网站,您可以举报多个网址,每行一个,一次不超过20个。";

if(!urls[0] || urls[0] == urlText){

$("#report_url_list").val(urlText).css("color","#757575");

$("#report_url_list").next(p).html(*请输入正确的网址);

$.urlfag=false;

return false;

}

if(urls.length > 20){

$("#report_url_list").next(p).html("已超过20个,请分批举报")

$.urlfag=false;

return false;

}

$.urlfag=true;

for(url_index=0;url_index<urls.length;url_index++){

$.urlfag = checkEachUrl(urls, url_index) && $.urlfag ;

}

return urlfag;

}

function checkEachUrl(urls, index){

var e=urls[index];

a = e.replace(/^http:///, "");

if (a.indexOf("/") != -1) {

a = a.substring(0, a.indexOf("/"));

}

var rg = /^((https?|ftp|news)://)?([w-]+.)+(.)+(:d+)?(/[w- ./?%&=]*)?$/i;

if(!rg.test(a)){

urlError("格式错误",index,-1);

return false;

}

if(inUrlArray(urls,index)){

urlError("请不要举报同一条网站",index,-1);

return false;

}

$.ajax({

async:false,

url:"http://api./tapi/url_report.php?url=http://"+a,

dataType: "jsonp",

method: "GET",

success:function(a){

if(a.is_existed=="yes"){

urlError("该网址已被举报",index,-1);

$.urlfag= false;

}

}

});

urlError("正常",index,0);

return true;

}

function inUrlArray(urls,index){

var r=false

for(i=index+1;i<urls.length;i++){

a = urls[index].replace(/^http(s?):///, "");

b = urls[i].replace(/^http(s?):///, "");

if(a==b)

r=true;

}

return r;

}

function urlError(msg,index,type){

type=type|| 0;

var test = $("#errorList div").find("span").eq(index);

test.show();

if(type<0){

test.attr( itle,msg).css("background-position","-20px 0px");

}else{

test.attr( itle,msg).css("background-position","0px 0px");

}

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。