//Check whether it is composed entirely of digits
function isDigit(s)
{
var patrn=/^[0-9]{1,20}$/;
if (!patrn.exec(s)) return false
return true
}
//Verify login name: only 5-20 characters starting with letters and numbers can be entered. Strings of "_" and "."
function isRegisterUserName(s)
{
var patrn=/^[a-zA-Z]{1}([a-zA-Z0 -9]|[._]){4,19}$/;
if (!patrn.exec(s)) return false
return true
}
//proof Verify user name: You can only enter 1-30 strings starting with letters
function isTrueName(s)
{
var patrn=/^[a-zA-Z]{1, 30}$/;
if (!patrn.exec(s)) return false
return true
}
//Verify password: only 6-20 letters can be entered, Numbers, underscores
function isPasswd(s)
{
var patrn=/^(w){6,20}$/;
if (!patrn.exec(s)) return false
return true
}
//Verify ordinary telephone and fax numbers: it can start with " ", and in addition to numbers, it can contain "-"
function isTel( s)
{
//var patrn=/^[ ]{0,1}(d){1,3}[ ]?([-]?(d){1,12}) $/ ;
var patrn=/^[ ]{0,1}(d){1,3}[ ]?([-]?((d)|[ ]){1,12}) $/;
if (!patrn.exec(s)) return false
return true
}
//Verification mobile phone number: must start with a number, in addition to numbers, it can contain "-"
function isMobil(s)
{
var patrn=/^[ ]{0,1}(d){1,3}[ ]?([-]?((d) |[ ]){1,12}) $/;
if (!patrn.exec(s)) return false
return true
}
//Verify postal code
function isPostalCode(s)
{
//var patrn=/^[a-zA-Z0-9]{3,12}$/;
var patrn=/^[a-zA-Z0- 9 ]{3,12}$/;
if (!patrn.exec(s)) return false
return true
}
//Verify search keywords
function isSearch( s)
{
var patrn=/^[^`~!@#$%^&*() =|\][]{}:;',./?]{1} [^`~!@$%^&() =|\][]{}:;',.?]{0,19}$/;
if (!patrn.exec(s) ) return false
return true
}
function isIP(s) //by zergling
{
var patrn=/^[0-9.]{1,20}$/;
if (!patrn.exec(s)) return false
return true
}
/*********************************************************************************
* FUNCTION: isBetween
* PARAMETERS: val AS any value
* lo AS Lower limit to check
* hi AS Higher limit to check
* CALLS: NOTHING
* RETURNS: TRUE if val is between lo and hi both inclusive, otherwise false.
***************
******************************************************************/
function isBetween (val, lo, hi) {
if ((val hi)) { return(false); }
else { return(true); }
}
/*********************************************************************************
* FUNCTION: isDate checks a valid date
* PARAMETERS: theStr AS String
* CALLS: isBetween, isInt
* RETURNS: TRUE if theStr is a valid date otherwise false.
**********************************************************************************/
function isDate ( theStr) {
var the1st = theStr.indexOf('-');
var the2nd = theStr.lastIndexOf('-');
if (the1st == the2nd) { return(false); }
else {
var y = theStr.substring(0,the1st);
var m = theStr.substring(the1st 1,the2nd);
var d = theStr.substring(the2nd 1,theStr .length);
var maxDays = 31;
if (isInt(m)==false || isInt(d)==false || isInt(y)==false) {
return(false ); }
else if (y.length else if (!isBetween (m, 1, 12)) { return(false); }
else if (m==4 || m==6 || m==9 || m==11) maxDays = 30;
else if (m==2) {
if (y % 4 > 0 ) maxDays = 28;
else if (y % 100 == 0 && y % 400 > 0) maxDays = 28;
else maxDays = 29;
}
if (isBetween(d, 1 , maxDays) == false) { return(false); }
else { return(true); }
}
}
/*********************************************************************************
* FUNCTION: isEuDate checks a valid date in British format
* PARAMETERS: theStr AS String
* CALLS: isBetween, isInt
* RETURNS: TRUE if theStr is a valid date otherwise false.
**********************************************************************************/
function isEuDate ( theStr) {
if (isBetween(theStr.length, 8, 10) == false) { return(false); }
else {
var the1st = theStr.indexOf('/');
var the2nd = theStr.lastIndexOf('/');
if (the1st == the2nd) { return(false); }
else {
var m = theStr.substring(the1st 1,the2nd );
var d = theStr.substring(0,the1st);
var y = theStr.substring(the2nd 1,theStr.length);
var maxDays = 31;
if (isInt( m)==false || isInt(d)==false || isInt(y)==false) {
return(false); }
else if (y.length else if (isBetween (m, 1, 12) == false) { return(false); }
else if (m==4 || m==6 || m==9 || m==11) maxDays = 30;
else if (m==2) {
if (y % 4 > 0) maxDays = 28;
else if (y % 100 == 0 && y % 400 > 0) maxDays = 28;
else maxDays = 29;
}
if (isBetween(d, 1, maxDays) == false) { return(false); }
else { return(true); }
}
}
}
/**************************************************** ****************************
* 기능: 날짜 비교! 어느 것이 최신입니까!
* 매개변수: lessDate,moreDate AS String
* 호출: isDate,isBetween
* 반환: lessDate****************인 경우 TRUE ************************************************** ***************/
function isComdate (lessDate , moreDate)
{
if (!isDate(lessDate)) { return(false);}
if (!isDate (moreDate)) { return(false);}
var less1st = lessDate.indexOf('-');
var less2nd = lessDate.lastIndexOf('-');
var more1st = moreDate.indexOf('-');
var more2nd = moreDate.lastIndexOf('-');
var lessy = lessDate.substrin(0,less1st);
var lessm = lessDate.substring(less1st 1,less2nd);
var lessd = lessDate.substring(less2nd 1,lessDate.length);
var morey = moreDate.substring(0,more1st);
var morem = moreDate.substring(more1st 1,more2nd);
var mored = moreDate.substring(more2nd 1,moreDate.length);
var Date1 = new Date(lessy,lessm,lessd);
var Date2 = new Date(morey,morem,mored);
if (Date1>Date2) { return(false);}
return(true);
}
/**************************************************** *****************************
* FUNCTION isEmpty는 매개변수가 비어 있는지 또는 null인지 확인합니다.
* PARAMETER str AS 문자열
********************************************** ************************************/
function isEmpty (str) {
if ((str==null)||(str.length==0)) return true;
그렇지 않으면 return(false);
}
/**************************************************** *****************************
* 함수: isInt
* 매개변수: theStr AS String
* RETURNS : 전달된 매개변수가 정수이면 TRUE, 그렇지 않으면 FALSE
* CALLS: isDigit
**************************** ************************************************** ****/
function isInt (theStr) {
var flag = true;
if (isEmpty(theStr)) { 플래그=false; }
else
{ for (var i=0; iif (isDigit(theStr.substring(i,i 1)) == false) {
플래그 = 거짓; 부서지다;
}
}
}
return(플래그);
}
/**************************************************** *****************************
* 기능: isReal
* 매개변수: heStr AS String
decLen AS 정수(마침표 뒤의 자릿수)
* 반환: theStr이 부동 소수점이면 TRUE, 그렇지 않으면 FALSE
* 호출: isInt
******************** ************************************************** ***************/
function isReal (theStr, decLen) {
var dot1st = theStr.indexOf('.');
var dot2nd = theStr.lastIndexOf('.');
var K = 참;
if (isEmpty(theStr))는 false를 반환합니다.
if (dot1st == -1) {
if (!isInt(theStr)) return(false);
그렇지 않으면 반환(true);
}
else if (dot1st != dot2nd) return (false);
else if (dot1st==0) return (false);
else {
var intPart = theStr.substring(0, dot1st);
var decPart = theStr.substring(dot2nd 1);
if (decPart.length > decLen) return(false);
else if (!isInt(intPart) || !isInt(decPart)) return (false);
else if (isEmpty(decPart)) return (false);
그렇지 않으면 반환(true);
}
}
/**************************************************** *****************************
* 기능: isEmail
* 매개변수: 문자열(이메일 주소)
* 반환: 문자열이 유효한 이메일 주소인 경우 TRUE
* 전달된 문자열이 유효한 이메일 주소가 아닌 경우 FALSE
* 이메일 형식: AnyName@EmailServer 예: webmaster@hotmail.com
* @ 기호는 이메일 주소에 한 번만 나타날 수 있습니다.
************************************************************************ **********************************/
function isEmail (theStr) {
var atIndex = theStr.indexOf('@');
var dotIndex = theStr.indexOf('.', atIndex);
var 플래그 = true;
theSub = theStr.substring(0, dotIndex 1)
if ((atIndex { return(false); }
else { return(true); }
}
/**************************************************** *****************************
* 기능: newWindow
* 매개변수: doc -> 열 문서 새 창
hite -> 새 창 높이
wide -> 새 창 너비
bars -> 1-스크롤 막대 = YES 0-스크롤 막대 = NO
크기 조정 -> 1- 크기 조정 가능 = 예 0-크기 조정 가능 = 아니요
* 호출: 없음
* 반환: 새 창 인스턴스
************************ ************************************************** *********/
function newWindow(doc, hite, wide, bar, resize) {
var winNew="_blank";
var pt="toolbar=0,location=0,directories=0,status=0,menubar=0,";
opt =("scrollbars=" 바 ",");
opt =("resizing=" 크기 조정 ",");
opt =("너비="와이드 ",");
opt =("height=" 하이트);
winHandle=window.open(doc,winNew,opt);
반환;
}
/*********************************************************************************
* FUNCTION: DecimalFormat
* PARAMETERS: paramValue -> Field value
* CALLS: NONE
* RETURNS: Formated string
**********************************************************************************/
function DecimalFormat (paramValue) {
var intPart = parseInt(paramValue);
var decPart =parseFloat(paramValue) - intPart;
str = " ";
if ((decPart == 0) || (decPart == null)) str = (intPart ".00");
else str = (intPart decPart);
return (str) ;
}
"^\d $" //Non-negative integer (positive integer 0)
"^[0-9]*[1-9][0-9]*$" // Positive integer
"^((-\d )|(0 ))$" //Non-positive integer (negative integer 0)
"^-[0-9]*[1-9][0- 9]*$" //Negative integer
"^-?\d $" //Integer
"^\d (\.\d )?$" //Non-negative floating point number (positive floating point number 0 )
"^(([0-9] \.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9 ]*\.[0-9] )|([0-9]*[1-9][0-9]*))$" //Positive floating point number
"^((-\d (\ .\d )?)|(0 (\.0 )?))$" //Non-positive floating point number (negative floating point number 0)
"^(-(([0-9] \.[0- 9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9] )|([0-9]* [1-9][0-9]*)))$" // Negative floating point number
"^(-?\d )(\.\d )?$" //Floating point number
"^ [A-Za-z] $" //A string consisting of 26 English letters
"^[A-Z] $" //A string consisting of 26 uppercase English letters
"^[a-z ] $" // A string consisting of 26 lowercase English letters
"^[A-Za-z0-9] $" // A string consisting of numbers and 26 English letters
"^ \w $" //A string consisting of numbers, 26 English letters or underscores
"^[\w-] (\.[\w-] )*@[\w-] (\.[\ w-] ) $" //email address
"^[a-zA-z] ://(\w (-\w )*)(\.(\w (-\w )*))* (\?\S*)?$" //url