校验是否为正确格式的身份证号
/**
*校验是否为正确格式的身份证号
*/
function isIdenCard(num){ //num是传进来的身份证号 调用此方法即可 通过返回true false
if (isNaN(num)) {
$("#messageBox").html("<s:text name='doent.chainse'/>");
$("#messageBox").css("color","red");
$("#messageBox").show();
return false;}
var len = num.length, re;
if (len == 15)
re = new RegExp(/^(\d{6})()?(\d{2})(\d{2})(\d{2})(\d{3})$/);
else if (len == 18)
re = new RegExp(/^(\d{6})()?(\d{4})(\d{2})(\d{2})(\d{3})(\d)$/);
else {
$("#messageBox").html("<s:text name='content.length.number'/>");
$("#messageBox").css("color","red");
$("#messageBox").show();
return false;}
var a = num.match(re);
if (a != null)
{
if (len==15)
{
var D = new Date("19"+a[3]+"/"+a[4]+"/"+a[5]);
var B = D.getYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5];
}
else
{
var D = new Date(a[3]+"/"+a[4]+"/"+a[5]);
var B = D.getFullYear()==a[3]&&(D.getMonth()+1)==a[4]&&D.getDate()==a[5];
}
}
return true;
}