如下:
//根據身份證号自動判斷性别案例
function selectSex(obj) {
var customercode = $(obj).val();
if (customercode.length == 18) {
var sexcode = customercode.substring(16, 17);
var birth = customercode.substring(6, 10) + "-" + customercode.substring(10, 12) + "-" + customercode.substring(12, 14);
//偶數為女性,奇數為男性
if ((sexcode & 1) === 0) {
$("#buyerSex").val("000");
} else {
$("#buyerSex").val("001");
}
$('#birth').datebox('setValue', birth);
}
}
檢查身份證件有效期輸入是否正确
//檢查身份證件有效期輸入是否正确
function checkidefctdate()
{
var idefctdate = $("#idefctdate").datetimebox("getValue");
idefctdate = new Date(Date.parse(idefctdate.replace(/-/g, "/"))).valueOf();
var nowDate = new Date().valueOf();
if(idefctdate>nowDate){
alert("證件有效期起始日期有誤,請修改");
return false;
}
return true;
}
根據easyUI時間控件取值參考
var xxx= $("#loanbegindate").datebox('getValue');