﻿
/**
* 验证普通字串，只要字串中不包含特殊字符即可
*/
function checkTextDataForNORMAL(strValue)
{
	// 特殊字符验证格式
	var regTextChar = /([\*\"\'<>\/])+/ ;
	return !regTextChar.test(strValue);
}

/**
* 验证整数,包含正整数和负整数
*/
function checkTextDataForINTEGER(strValue)
{
	var regTextInteger = /^(-|\+)?(\d)*$/;
	return regTextInteger.test(strValue);
}

/**
* 检查是否为正整数 
*/
function isUnsignedInteger(strInteger) 
{ 
  var newPar=/^\d+$/ 
  return newPar.test(strInteger); 
}

function checkMoney(strValue, strUnit)
{
	var testMoney = eval("/^\\d+(\\.\\d{0," + (strUnit.length -1) + "})?$/");
	return testMoney.test(strValue);
}

/**
* 验证浮点数
*/
function checkTextDataForFLOAT(strValue)
{
	var regTextFloat = /^(-)?(\d)*(\.)?(\d)*$/;
	return regTextFloat.test(strValue);
}

/**
* 验证数字
*/
function checkTextDataForNUMBER(strValue)
{
	var regTextNumber = /^(\d)*$/;
	return regTextNumber.test(strValue);
}

/**
* 验证英文字母，不区分大小写
*/
function checkTextDataForENGLISH(strValue)
{
	var regTextEnglish = /^[a-zA-Z]*$/;
	return regTextEnglish.test(strValue);
}

/**
* 验证大写英文字母
*/
function checkTextDataForENGLISHUCASE(strValue)
{
	var regTextEnglishUCase = /^[A-Z]*$/;
	return regTextEnglishUCase.test(strValue);
}

/**
* 验证小写英文字母
*/
function checkTextDataForENGLISHLCASE(strValue)
{
	var regTextEnglishLCase = /^[a-z]*$/;
	return regTextEnglishLCase.test(strValue);
}

/**
* 验证英文字母和数字，不区分大小写
*/
function checkTextDataForENGLISHNUMBER(strValue)
{
	var regTextEnglishNumber = /^[a-zA-Z0-9]*$/;
	return regTextEnglishNumber.test(strValue);
}

/**
* 验证时间
*/
function checkTextDataForTIME(strValue)
{
	var regTextTime = /^(\d+):(\d{1,2}):(\d{1,2})$/;
	return regTextTime.test(strValue);
}

//判断手机号是否正确
function regIsPhone(fData)
{
    var reg = /^(\+86)?(1[0-9]{10})$/;
    return reg.test(fData);
}

/**
* 验证电话号码
*/
function checkTextDataForPHONE(strValue)
{
	var regTextPhone =/(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{3,4}[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}1[3|5]{1}[0-9]{9}$)/;
	return regTextPhone.test(strValue);
}

/**
* 验证EMail
*/
function checkTextDataForEMAIL(strValue)
{
	var regTextEmail = /^([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\-|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/gi;
	return regTextEmail.test(strValue);
}

/**
* 验证URL
*/
function checkTextDataForURL(strValue)
{
	var regTextUrl = /^(file|http|https|ftp|mms|telnet|news|wais|mailto):\/\/(.+)$/;
	return regTextUrl.test(strValue);
}

/**
* 验证邮政编码
*/
function checkTextDataForPOST(strValue)
{
	var regTextPost = /^(\d){6}$/;
	return regTextPost.test(strValue);
} 

/**
*输入空件是否为空验证
*/
function checkTextDataForVERIFICAT(strValue)
{
	if(document.getElementById(strValue).value=="")
	{
		alert("联系人不能为空！");
		return false;
	}
}
