//------------------------------------------------------------------------------------------------ // 홈페이지별 종속적인 JAVASCRIPT 함수 정의 //------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------ // 공통함수 Include //------------------------------------------------------------------------------------------------ // 공통 document.write(''); //file 관련 document.write(''); // 퍼블리싱 일반 document.write(''); //---------------------------------------------------------------------------------------------------- //-- 아이디&비밀번호 검사 함수 //---------------------------------------------------------------------------------------------------- // 아이디 유효성검사 - 프로그램 (김기영) function checkID(obj,strNN) { // 아이디의 유효성확인 (자리수, 문자열) // obj - 확인할 object // strNN - 오류시 표시할 문자열 / 값이 없으면 Default 메세지 출력 // return - true or false if(obj.value){ // 자리수 검사 if((obj.value.length < 4) || (obj.value.length > 20)){ if(strNN) alert(strNN); else alert("아이디는 4~20자만 가능 합니다."); selectAll(obj); return false; } // 문자열 검사 var validstr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var targetstr = obj.value.toUpperCase(); for (i = 0; i < targetstr.length; i++){ if(validstr.indexOf(targetstr.substring(i, i+1)) < 0){ if(strNN) alert(strNN); else alert("아이디는 숫자 또는 영문자만 가능 합니다."); selectAll(obj); return false; } } return true; } } // 비밀번호 유효성검사 - 프로그램 (김기영) function checkPW(obj,strNN) { // 비밀번호 유효성확인 (자리수, 문자열) // obj - 확인할 object // strNN - 오류시 표시할 문자열 / 값이 없으면 Default 메세지 출력 // return - true or false if(obj.value){ // 자리수 검사 if((obj.value.length < 4) || (obj.value.length > 20)){ if(strNN) alert(strNN); else alert("비밀번호는 4~20자만 가능 합니다."); selectAll(obj); return false; } // 문자열 검사 var validstr = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var targetstr = obj.value.toUpperCase(); for (i = 0; i < targetstr.length; i++){ if(validstr.indexOf(targetstr.substring(i, i+1)) < 0){ if(strNN) alert(strNN); else alert("비밀번호는 숫자 또는 영문자만 가능 합니다."); selectAll(obj); return false; } } return true; } } // 코드 유효성검사 - 프로그램 (김기영) function checkCode(obj,strNN) { // 코드의 유효성확인 (자리수, 문자열) // obj - 확인할 object // strNN - 오류시 표시할 문자열 / 값이 없으면 Default 메세지 출력 // return - true or false // 자리수 검사 if((obj.value.length < 2) || (obj.value.length > 20)){ if(strNN) alert(strNN); else alert("2~20자의 코드를 입력해 주십시오."); selectAll(obj); return false; } // 문자열 검사 var validstr = "0123456789_ABCDEFGHIJKLMNOPQRSTUVWXYZ"; var targetstr = obj.value.toUpperCase(); for (i = 0; i < targetstr.length; i++){ if(validstr.indexOf(targetstr.substring(i, i+1)) < 0){ if(strNN) alert(strNN); else alert("숫자 또는 영문자만 가능 합니다."); selectAll(obj); return false; } } return true; } //---------------------------------------------------------------------------------------------------- //-- 우편번호 검색 팝업창 호출 함수 //---------------------------------------------------------------------------------------------------- function openpost(FORM,ZIP1,ZIP2,ADDR1,ADDR2) { // URL : 우편번호 팝업의 위치 // FORM : 폼이름 // ZIP1 : 우편번호 앞자리 입력 input box 이름 // ZIP2 : 우편번호 뒷자리 입력 input box 이름 // ADDR1 : 주소1 input box 이름 // 우편번호 조회창을 띄움 var winobj; winobj=window.open('/section/zipcode/reg_address.html?param_form='+FORM+'¶m_zipcode1='+ZIP1+'¶m_zipcode2='+ZIP2+'¶m_addr1='+ADDR1+'¶m_addr2='+ADDR2,'post','toolbar=no,location=no,directory=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=435,height=180'); if (winobj!=null) winobj.focus(); } //---------------------------------------------------------------------------------------------------- //-- 화면인쇄함수 //---------------------------------------------------------------------------------------------------- var PrintForHtmlContent; function printDiv () { if (document.all && window.print) { window.onbeforeprint = beforeDivs; window.onafterprint = afterDivs; window.print(); } } function beforeDivs () { if (document.all) { var rng = document.body.createTextRange( ); if (rng!=null) { //alert(rng.htmlText); PrintForHtmlContent = rng.htmlText; rng.pasteHTML("
" + document.all["PrintArea"].innerHTML + "
"); } } } function afterDivs () { if (document.all) { var rng = document.body.createTextRange( ); if (rng!=null) { alert(PrintForHtmlContent); rng.pasteHTML(PrintForHtmlContent); var rng2 = document.body.createTextRange( ); alert(rng2.htmlText); } } } //---------------------------------------------------------------------- //* 배너 스크롤 class //* 속성 //* type : 스크롤 방향 구분(1:수직 스크롤, 2:수평 스크롤) //* leftRightDirection : 수평 스크롤 방향 구분(1:왼쪽, 2:오른쪽) //* pausemouseover : 마우스 포인터 over 시 스크롤 정지 여부(true:정지, false:정지 안함) //* layerwidth : 스크롤내용이 보여지는 영역 가로 사이즈 //* 사용법 //* var bannerScroll = new BannerScroll(); //* bannerScroll.name = "bs_1"; //* bannerScroll.type = 2; //* bannerScroll.pausemouseover = true; //* bannerScroll.add("배너1"); //* bannerScroll.add("배너2"); //* bannerScroll.add("배너3"); //* bannerScroll.start(); //---------------------------------------------------------------------- function BannerScroll() { this.version = "0.1"; this.name = "bannerScroll"; this.item = new Array(); this.itemcount = 0; this.currentspeed = 0; this.scrollspeed = 20; this.pausedelay = 1000; this.pausemouseover = false; this.stop = false; this.type = 2; this.leftRightDirection = 1; this.layerwidth = 100; this.height = 100; this.width = 100; this.stopHeight = 0; this.add = function() { var text = arguments[0]; this.item[this.itemcount] = text; this.itemcount = this.itemcount + 1; }; this.start = function() { this.display(); this.currentspeed = this.scrollspeed; setTimeout(this.name+'.scroll()',this.currentspeed); }; this.display = function() { document.write('
'); for (var i = 0; i < this.itemcount; i++) { if ( this.type == 1) { document.write('
'); document.write(this.item[i]); document.write('
'); } else if ( this.type == 2 ) { document.write('
'); document.write(this.item[i]); document.write('
'); } } document.write('
'); }; this.scroll = function() { this.currentspeed = this.scrollspeed; if( !this.stop ) { for (i = 0; i < this.itemcount; i++) { obj = document.getElementById(this.name+'item'+i).style; if( this.type == 1 ) { obj.top = (parseInt(obj.top) - 2) + "px"; if( parseInt(obj.top) <= this.height*(-1) ) { obj.top = (this.height * (this.itemcount-1)) + "px"; this.currentspeed = this.pausedelay; } //if ( parseInt(obj.top) == 0 || ( this.stopHeight > 0 && this.stopHeight - parseInt(obj.top) == 0 ) ) } else if ( this.type == 2 ) { if (this.leftRightDirection == 1) { obj.left = (parseInt(obj.left) - 1) + "px"; if ( parseInt(obj.left) <= this.width*(-1) ) { obj.left = (parseInt(obj.left) + (this.width * (this.itemcount))) + "px"; this.currentspeed = this.pausedelay; } } else { obj.left = (parseInt(obj.left) + 1) + "px"; if ( parseInt(obj.left) >= this.layerwidth ) { obj.left = (parseInt(obj.left) - (this.width * (this.itemcount))) + "px"; this.currentspeed = this.pausedelay; } } } } } window.setTimeout(this.name+".scroll()",this.currentspeed); }; this.mouseover = function() { if ( this.pausemouseover ) { this.stop = true; } }; this.mouseout = function () { if ( this.pausemouseover ) { this.stop = false; } }; } function SelectItem(value, text) { this.text = text; this.value = value; this.text = text; this.getValue = function () { return this.value; }; this.getText = function () { return this.text; }; }