본문 바로가기

Develop

(147)
12 시간 AM/PM 형식으로 표현 var d = new Date('1999-12-31 13:46'); // returns date object in 12hr (AM/PM) format function formatAMPM(date) { var yyyyMMdd = date.getFullYear()+ '. ' + (date.getMonth()+1)+ '. ' + date.getDate(); var hours = date.getHours(); var minutes = date.getMinutes(); return yyyyMMdd + ' ' + (hours < 12 ? 'A' : 'P') + 'M' + ' ' + (hours % 12 || 12) + ':' + minutes.toString().padStart(2, '0'); } formatAMP..
숫자 3자리 단위마다 콤마(comma) 찍기 function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } 참고 - 참고 : http://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript 출처: https://fruitdev.tistory.com/160 [과일가게 개발자]
ajax 로 데이타를 처리할 때 request 의 Referer 를 반드시 체크할 것 String referer = request.getHeader("Referer"); // 보안성 검토. 정상적이지 않은 방법으로 접근시 차단 if(referer.length()==0) return; // 엉뚱한 곳에서 호출하면 리턴, 이건 해킹 시도라고 봐야지.. else if(referer.indexOf("aaa.jsp")>-1) ; // http://www..../aaa.jsp 명확한 경로를 기술 else if(referer.indexOf("bbb.jsp")>-1) ; // http://www..../bbb.jsp 명확한 경로를 기술 else if(referer.indexOf("ccc.jsp")>-1) ; // http://www..../cccjsp 명확한 경로를 기술 else{ System.out...
History 객체 https://developer.mozilla.org/ko/docs/Web/API/History_API 브라우저 히스토리 조작하기 DOM의 window 객체는 history 객체를 통해 브라우저 히스토리에 접근할 수 있습니다. HTML5의 history 객체는 사용자 히스토리에서의 앞 뒤 이동이 가능하도록 유용한 메서드와 속성들을 제공하며, history stack의 내용을 조작할 수 있게 합니다. developer.mozilla.org https://iamawebdeveloper.tistory.com/42 History 객체 History 객체 Window 객체의 history 프로퍼티는 History 객체를 가리킨다. History 객체 모델은 브라우징 히스토리를 문서와 문서 상태 목록으로 저장한다...
Slick Carousel의 이벤트에서 슬라이드 요소를 가져 오는 방법 $('.your-element').on('afterChange', function(event, slick, currentSlide){ console.log(currentSlide); });
[Html5] History/State를 이용하여 뒤로가기 이벤트 체크하기 0. 들어가기 전에 HTML5에서는 history/state라는 페이지에 대한 상태를 저장하는 기능이 있습니다. pushState나 replaceState등을 이용해서 페이지를 나누고 값을 추가해서 던져주는등 단일 페이지에서 URL을 다르게 주기 위해서 많이 사용하는 기능이지만 여기에서는 뒤로가기를 할 때 발생되는 이벤트를 제어하기 위해서 사용하는 케이스를 짤막하게 소개해 봅니다. 1. HTML5에서의 뒤로가기 체크 이벤트 호출 특정 페이지 혹은 전 페이지에서 뒤로가기를 할 때 뒤로가기가 아니라 새로고침을 하고 싶다면 아래와 같은 식으로 사용 할 수 있습니다. history.pushState(null, null, ''); window.onpopstate = function(event) { var prev..
GitLab 설정 및 올리기 [GitLab] You are not allowed to push code to protected branches on this project 출처: https://ipex.tistory.com/entry/GitLab-You-are-not-allowed-to-push-code-to-protected-branches-on-this-project [깍돌이] master -> master[rejected -non-fast-forward] 출처: https://ipex.tistory.com/entry/master-masterrejected-nonfastforward [깍돌이] GIT에서 강제로 Push 하기 / push 에러 해결하기 ( error: failed to push some refs to ) 출처: ..
form내에 선언된 button과 input 태그에서 임의로 submit이 동작하는 경우 form내에 선언된 button과 input 태그에서 임의로 submit이 동작하는 경우 1. button에서 의도와 다르게 계속 submit이 되는 경우 type="button"을 선언해 주면 해결됨 아래와 같은 경우 버튼을 클릭시 form submit이 발생한다. 등록 2. input text 입력 후 Enter 키 입력시 submit 이벤트가 발생하는 경우 form 에서는 아래와 같이 event 를 제어할수 있음, 그외 jquery 등으로 이벤트 제어 가능