正则表达式(身份证号)

var identity = document.getElementById( "ctl00_ContentPlaceHolder1_tbidentity").value;
    if(identity.gblen()>18)
    {

      showAlert("身份证号最多为18位!");
      return false;
    }

    if (!identity.match(/^(:\d{15}|\d{18}|\d{17}x)$/))
      {
      showAlert("请输入正确的身份证号!");
     return false;
      }   
}
posted @ 2008-10-24 15:58  做你所想  阅读(457)  评论(0)    收藏  举报