// 身份證字號
function checkID(string) {
  re = /^[A-Z]\d{9}$/;
  if (re.test(string))
   return true; 
 }
 
// 信用卡號
function checkCreditCard(string) {
  re = /^\d{4}-\d{4}-\d{4}-\d{4}$/;
 // re = /^(\d{4}-){3}\d{4}$/;
  if (re.test(string))
   return true; 
 }
 
// 英文名稱
function checkEnglishName(string) {
  re1 = /^[A-Za-z\-]+\s+[A-Za-z\-]+$/;
  re2 = /^[A-Za-z\-]+\s+[A-Za-z\-]+\s+[A-Za-z\-]+$/;
  if (re1.test(string) || re2.test(string))
   return true; 
 }
 
// Email
function checkEmail(string) {
  re = /^.+@.+\..{2,3}$/;
  if (re.test(string))
   return true; 
 }
 
// 數字
function checkNumber(string) {
  re = /^\d+$/;
  if (re.test(string))
   return true; 
 }
 
// TextBox
function checkValue(aTextID)
 {  
  re = /\S/;
  var oText = document.all[aTextID];
  var sVal = Trim(oText.value);  
  if(!re.test(sVal)){
   try{
    alert("[" + oText.title + "]" + " 必需填寫!")
    event.returnValue = false;
    oText.focus();
    return false;
   }
   catch (e){
    //alert(e.description);
   }
  }
  return true;
 } 

arrow
arrow
    全站熱搜

    felixhuang 發表在 痞客邦 留言(0) 人氣()