336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
//----------------------------------------------------------------------------- 값이 없음을 체크
//----------------------------------------------------------------------------- 영문&숫자 및 "-", "_" 만 허용
//----------------------------------------------------------------------------- 값의 길이를 제한하는 함수
//----------------------------------------------------------------------------- 공백없이 한글만
//----------------------------------------------------------------------------- 숫자만 입력해야하는 경우.
//----------------------------------------------------------------------------- 포커스 이동
//----------------------------------------------------------------------------- 주민번호 체크
//----------------------------------------------------------------------------- Email 주소 체크
//----------------------------------------------------------------------------- 특정 Email 주소 체크
//----------------------------------------------------------------------------- 입력 Byte 제한
function noValue(formName,inputName,alertMsg){ var Doc = document.forms[formName] ; if (!Doc.elements[inputName].value){ alert(alertMsg + " 을 입력하십시요.") ; Doc.elements[inputName].focus() ; return false; } }//----------------------------------------------------------------------------- 값이 없음을 체크 END
//----------------------------------------------------------------------------- 영문&숫자 및 "-", "_" 만 허용
function inputValChk(formName,inputName,alertMsg){ var Doc = document.forms[formName] ; var mId = Doc.elements[inputName].value ; var Ch = mId.charAt(0) ; for (i = 0 ; i < mId.length ; i++){ Ch = mId.charAt(i) ; if ((Ch >= '0' && Ch <= '9') || (Ch >= 'a' && Ch <= 'z') || (Ch == '_' || Ch == '-')){ continue ; }else{ alert(alertMsg + "는 영문자(소문자), 숫자, '-' , '_' 만 사용하실 수 있습니다.") ; Doc.elements[inputName].value = "" ; Doc.elements[inputName].focus() ; return false; } } }//----------------------------------------------------------------------------- 영문&숫자 및 "-", "_" 만 허용 END
//----------------------------------------------------------------------------- 값의 길이를 제한하는 함수
function inputValLen(formName,inputName,alertMsg,firstInt,SecondInt){ var Doc = document.forms[formName]; if (Doc.elements[inputName].value.length < firstInt || Doc.elements[inputName].value.length > SecondInt){ alert(alertMsg + "의 길이는 " + firstInt + "자 이상 " + SecondInt + "자 이하여야 합니다."); Doc.elements[inputName].value = "" ; Doc.elements[inputName].focus() ; return false } }//----------------------------------------------------------------------------- 값의 길이를 제한하는 함수 END
//----------------------------------------------------------------------------- 공백없이 한글만
function inputValKor(formName,inputName,alertMsg){ var Doc = document.forms[formName] ; var Ch = Doc.elements[inputName].value.charAt(0); if (Doc.elements[inputName].value){ var Ch = Doc.elements[inputName].value.charCodeAt(0) ; for (i = 0 ; i < Doc.elements[inputName].value.length ; i++){ Ch = Doc.elements[inputName].value.charCodeAt(i) ; if (Ch > 31 && Ch < 127){ alert(alertMsg + "은 띄어쓰기 없이 한글만 사용하실 수 있습니다.") ; Doc.elements[inputName].value = "" ; Doc.elements[inputName].focus() ; return false; } } } }//----------------------------------------------------------------------------- 공백없이 한글만 END
//----------------------------------------------------------------------------- 숫자만 입력해야하는 경우.
function inputNotNum(formName,inputName,alertMsg){ var Doc = document.forms[formName].elements[inputName] ; var Ch = Doc.value.charAt(0); for(i = 0; i < Doc.value.length; i++){ Ch = Doc.value.charAt(i); if (Ch >= '0' && Ch <= '9'){ continue ; }else{ alert(alertMsg + "은 숫자만 입력가능합니다."); Doc.value = "" ; Doc.focus() ; return false; } } }//----------------------------------------------------------------------------- 숫자만 입력하야하는 경우. END
//----------------------------------------------------------------------------- 포커스 이동
function curMove(formName,inputName1,inputLen,inputName2){ var Doc = document.forms[formName] ; if(Doc.elements[inputName1].value.length == inputLen){ Doc.elements[inputName2].focus(); } }//----------------------------------------------------------------------------- 포커스 이동 END
//----------------------------------------------------------------------------- 주민번호 체크
function juminChk(formName,jumin1,jumin2){ var Doc = document.forms[formName] ; var J1 = Doc.elements[jumin1].value ; var J2 = Doc.elements[jumin2].value ; var f1=J1.substring(0,1); var f2=J1.substring(1,2); var f3=J1.substring(2,3); var f4=J1.substring(3,4); var f5=J1.substring(4,5); var f6=J1.substring(5,6); var hap=f1*2+f2*3+f3*4+f4*5+f5*6+f6*7; var l1=J2.substring(0,1); var l2=J2.substring(1,2); var l3=J2.substring(2,3); var l4=J2.substring(3,4); var l5=J2.substring(4,5); var l6=J2.substring(5,6); var l7=J2.substring(6,7); hap=hap+l1*8+l2*9+l3*2+l4*3+l5*4+l6*5; var rem=hap%11; rem=(11-rem)%10; if (rem != l7) { alert("정확한 주민등록번호를 입력해 주세요."); Doc.elements[jumin1].value = ""; Doc.elements[jumin2].value = ""; Doc.elements[jumin1].focus(); return false; } }//----------------------------------------------------------------------------- 주민번호 체크 END
//----------------------------------------------------------------------------- Email 주소 체크
function emailChk(formName,inputName){ var Doc = document.forms[formName] ; if( Doc.elements[inputName].value.length > 0 && Doc.elements[inputName].value.search(/(\S+)@(\S+)\.(\S+)/) == -1 ){ alert("정확한 이메일주소를 입력해 주십시요."); Doc.elements[inputName].value = ""; Doc.elements[inputName].focus(); return false; } }//----------------------------------------------------------------------------- Email 주소 체크 END
//----------------------------------------------------------------------------- 특정 Email 주소 체크
function spemailChk(formName,inputName,spMail,alertMsg){ var Doc = document.forms[formName] ; if((Doc.elements[inputName].value.indexOf(spMail) != -1)) { alert(alertMsg + "은 사용할수 없습니다."); Doc.elements[inputName].value = ""; Doc.elements[inputName].focus(); return false; } }//----------------------------------------------------------------------------- 특정 Email 주소 체크 EN
//----------------------------------------------------------------------------- 입력 Byte 제한
function updateChar(formName,inputName,length_limit){ var Doc = document.forms[formName] ; var length = calculate_msglen(Doc.elements[inputName].value); if (length > length_limit) { alert("최대 " + length_limit + "byte이므로 초과된 글자수는 자동으로 삭제됩니다."); Doc.elements[inputName].value = Doc.elements[inputName].value.replace(/\r\n$/, ""); Doc.elements[inputName].value = assert_msglen(Doc.elements[inputName].value, length_limit); } } function calculate_msglen(message){ var nbytes = 0; for (i=0; i<message.length; i++) { var ch = message.charAt(i); if(escape(ch).length > 4) { nbytes += 2; } else if (ch == '\n') { if (message.charAt(i-1) != '\r') { nbytes += 1; } } else if (ch == '<' || ch == '>') { nbytes += 4; } else { nbytes += 1; } } return nbytes; } function assert_msglen(message, maximum){ var inc = 0; var nbytes = 0; var msg = ""; var msglen = message.length; for (i=0; i<msglen; i++) { var ch = message.charAt(i); if (escape(ch).length > 4) { inc = 2; } else if (ch == '\n') { if (message.charAt(i-1) != '\r') { inc = 1; } } else if (ch == '<' || ch == '>') { inc = 4; } else { inc = 1; } if ((nbytes + inc) > maximum) { break; } nbytes += inc; msg += ch; } return msg; }//----------------------------------------------------------------------------- 입력 Byte 제한