jquery 验证身份证
// 验证身份证
function isCardID(sId) {
var iSum = 0;
var info = "";
if(!/^\d{17}(\d|x)$/i.test(sId)) return "你输入的身份证长度或格式错误";
sId = sId.replace(/x$/i, "a");
sBirthday = sId.substr(6, 4) + "-" + Number(sId.substr(10, 2)) + "-" + Number(sId.substr(12, 2));
var d = new Date(sBirthday.replace(/-/g, "/"));
if(sBirthday != (d.getFullYear() + "-" + (d.getMonth() + 1) + "-" + d.getDate())) return "您输入的身份证号非法";
for(var i = 17; i >= 0; i--) iSum += (Math.pow(2, i) % 11) * parseInt(sId.charAt(17 - i), 11);
if(iSum % 11 != 1) return "您输入的身份证号非法";
return true;
}