-1-關(guān)于jquery.validate.js
$("input").on("input",function(){
$(this).removeData("previousValue").valid();
});//添加此句能夠在輸入的時候清除緩存,從而保證隨時更新最新提示信息道盏,特別是在有remote的時候比較有效款熬;
$("form").valid()返回boolean哪轿,進行有效性驗證坷襟;
-2- 關(guān)于驗證碼倒計時按鈕
InterValObj = window.setInterval(SetRemainTime, 1000); //啟動計時器撤嫩,1秒執(zhí)行一次
//timer處理函數(shù)
function SetRemainTime() {
if (curCount == 0) {
window.clearInterval(InterValObj);//停止計時器
$("#btnSendCode").removeAttr("disabled");//disabled按鈕需要另外設置樣式裁眯,eg:input:disabled{}
$("#btnSendCode").val("重新發(fā)送驗證碼");
}
else {
curCount--;
$("#btnSendCode").val("請在" + curCount + "秒內(nèi)輸入");
}
}
-3- 關(guān)于點擊更改圖片
function onchangePatchca() {
var xmlR = Math.random(10000);
$(".tx-code-img").attr("src", "/captcha?rd=" + xmlR);
}
-4-點擊眼睛更改密碼框的可見性
function changeTypeOfPassword(that){
if($(that).siblings(".input").attr("type")==="password"){
var val=$(that).siblings(".input[type='password']").val();
$(that).parent().append('');
$(that).siblings(".input[type='password']").remove();$(that).attr("src","input_eye_active.png");
}else{
var val=$(that).siblings(".input").val();
$(that).parent().append('');
$(that).siblings(".input[type='text']").remove();$(that).attr("src","input_eye.png");
}
}