/* */ // 주의 : 브릭은 기본 인코딩이 EUC-KR 이지만 이 스크립트 파일을 EUC-KR 로 저장하면 메세지가 깨지므로 이 파일을 UTF-8로 저장하도록 한다. // 그래야 메세지에 한글이 안깨진다. if (typeof(WREST_JS) == 'undefined') // 한번만 실행 { var WREST_JS = true; var wrestMsg = ''; var wrestFld = null; /* // 샘플 function fboardgroup_check(f) { if (wrestRequired(f.gr_id)) return; if (wrestAlphaNumeric(f.gr_id)) return; if (wrestRequired(f.gr_subject)) return; f.action = "./boardgroup_form_update.php"; f.submit(); } */ // 영문자와 숫자 그리고 _ 검사 function wrestAlphaNumericUnderLine(fld) { if (!wrestTrim(fld)) return; var pattern = /(^[a-zA-Z0-9\_]+$)/; if (!pattern.test(fld.value)) { if (wrestFld == null) { wrestMsg = wrestItemname(fld) + " : 영문, 숫자, _ 가 아닙니다.\n"; wrestFld = fld; alert(wrestMsg); fld.focus(); return fld; } } } function wrestAlphaNumeric(fld) { var pattern = /(^[a-zA-Z0-9]+$)/; var wrestMsg; if (!pattern.test(fld.value)) { wrestMsg = wrestItemname(fld) + " : 영문 또는 숫자가 아닙니다.\n"; alert(wrestMsg); fld.focus(); return fld; } return false; } function wrestItemname(fld) { var itemname = fld.getAttribute("itemname"); if (itemname != null && itemname != "") return itemname; else return fld.name; } // 양쪽 공백 없애기 function wrestTrim(fld) { var pattern = /(^\s*)|(\s*$)/g; // \s 공백 문자 fld.value = fld.value.replace(pattern, ""); return fld.value; } // 필수 입력 검사 function wrestRequired(fld, foc) { var wrestMsg; if (foc == null) foc = true; if (wrestTrim(fld) == "") { // 3.30 // 셀렉트박스일 경우에도 필수 선택 검사합니다. wrestMsg = wrestItemname(fld) + " : 필수 "+(fld.type=="select-one"?"선택":"입력")+"입니다.\n"; alert(wrestMsg); if (foc == true) fld.focus(); return true; } return false; } for (var i = 0; i < document.forms.length; i++) { for (var j = 0; j < document.forms[i].elements.length; j++) { // 필수 입력일 경우는 * 배경이미지를 준다. if (document.forms[i].elements[j].getAttribute("required") != null) { document.forms[i].elements[j].style.backgroundImage = "url(/js/wrest.gif)"; document.forms[i].elements[j].style.backgroundPosition = "top right"; document.forms[i].elements[j].style.backgroundRepeat = "no-repeat"; } } } }