小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

jquery對(duì)cookie的操作,輸入一定次數(shù),幾分鐘后輸入

 走墨 2014-09-22
  

驗(yàn)證證書(shū)的時(shí)候 ,要求錯(cuò)誤五次之后就要等十分鐘之后輸入。


if ($.cookie("testCnt") == "5") {
$("#result").html('<font color=\"red\">輸入錯(cuò)誤次數(shù)超過(guò)5次,10分鐘之后再試!</font>');
$("#certificate").focus();
return false;
    }

一下是驗(yàn)證方法:

function testCertificate(){
if ($.cookie("testCnt") == "5") {
$("#result").html('<font color=\"red\">輸入錯(cuò)誤次數(shù)超過(guò)5次,10分鐘之后再試!</font>');
$("#certificate").focus();
return false;
    }
$("#result").html('<font color=\"green\">請(qǐng)輸入證書(shū)編號(hào)!</font>');
$("#tijiao").replaceWith("<a href=\"###\" id=\"tijiao\"  class=\"btn05\" >添加</a>");
var id=$("#certificate").val();
if(id==''){
$("#result").html('<font color=\"red\">證書(shū)編號(hào)不能為空!</font>');
$("#tijiao").replaceWith("<a href=\"###\" id=\"tijiao\" onclick=\"testCertificate()\" class=\"btn05\" >添加</a>");
$("#certificate").focus();
//$.cookie("example", "foo",{expires:cookietime}); 
return false;
}else{
$.ajax({
type:'post',
url:'${root}/base/BaseCertificateUser/ajaxTestCertifyValidation.jspx?id='+id,
success:function(msg){
if(msg=="-1"){
//證書(shū)填寫(xiě)錯(cuò)誤
$("#result").html('<font color=\"red\">證書(shū)填寫(xiě)錯(cuò)誤!</font>');
$("#tijiao").replaceWith("<a href=\"###\" id=\"tijiao\" onclick=\"testCertificate()\" class=\"btn05\" >添加</a>");
t+=1;
var cookietime = new Date(); 
cookietime.setTime(cookietime.getTime() + ( 10*60 * 1000));//coockie保存10分鐘 
$.cookie("testCnt",t,{expires:cookietime});
$("#certificate").focus();
return false;
}else if(msg=="-2"){
//驗(yàn)證失敗,請(qǐng)重新驗(yàn)證
$("#result").html('<font color=\"red\">驗(yàn)證失敗,請(qǐng)重新驗(yàn)證!</font>');
$("#tijiao").replaceWith("<a href=\"###\" id=\"tijiao\" onclick=\"testCertificate()\" class=\"btn05\" >添加</a>");
t+=1;
var cookietime = new Date(); 
cookietime.setTime(cookietime.getTime() + ( 10*60 * 1000));//coockie保存20秒 
$.cookie("testCnt",t,{expires:cookietime});
$("#certificate").focus();
return false;
}else if(msg=="0"){
//該證書(shū)不可用
$("#result").html('<font color=\"red\">該證書(shū)不可用!</font>');
$("#tijiao").replaceWith("<a href=\"###\" id=\"tijiao\" onclick=\"testCertificate()\" class=\"btn05\" >添加</a>");
t+=1;
var cookietime = new Date(); 
cookietime.setTime(cookietime.getTime() + ( 10*60 * 1000));//coockie保存20秒 
$.cookie("testCnt",t,{expires:cookietime});
$("#certificate").focus();
return false;
}else if(msg=="2"){
$.ajax({
type:'post',
url:'${root}/base/BaseCertificateUser/saveMyCertificate.jspx?id='+id,
success:function(){
$.cookie("testCnt",null); //驗(yàn)證成功后,撤銷(xiāo)session
var api = frameElement.api, W = api.opener;
parent.refreshPage();
W.lhgdialog.list['addCertificate1'].close();
}
});
}
}
});
}
}

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶(hù)發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多