var MYOBJ = function(){} MYOBJ.prototype = { parent : { child : this act : function(){ console.log(this); console.log(this.child); } } } var myObj = new MYOBJ(); myObj.parent.act(); 0단계 루트객체 myObj 1단계 부모객체 parent 2단계 자식객체 child 위에서 act()를 호출하면 console.log(this)는 act 보다 한단계 위에 있는 parent를 출력합니다. console.log(this.child) 는 무엇이 출력될까요? myObj.parent 가 출력될 것을 기대했지만, … 계속 읽기 자식 객체에서 부모객체(_root, _parent) 연결하기(커스텀 소스)
iframe 자동 높이 조절
IFRAME은 일반 FRAMESET과 달리, 원하는 위치에 원하는 사이즈 만큼 편리하게 배치할 수 있다는 장점이 있습니다. TABLE의 사이즈를 정해주고 TD 안에 이미지를 넣듯이 말이죠. 백문이 불여일견 함 해보세요. 아무 HTML파일을 만드셔서 아래의 사용방법처럼 넣어주시고요. 개인적으로 <TD>요기</TD> 들어가는 것을 좋아합니다. 사용밥법 < iframe width=602 height=494 name=frame1 marginWidth=0 marginHeight=0 frameBorder=no scrolling=no></iframe > IFRAME의 구성 src: 프레임에 들어갈 url 지정width: iframe의 … 계속 읽기 iframe 자동 높이 조절
CSS에서 엘리먼트 화면높이 100%만큼 설정하기
아래와 같은 html과 css가 있다면 높이가 의도되로 100%가 되지 않는다. <html> <header> <style> div#main{ width:100%; height:100%; border:solid 1px lightgray; } </style> </header> <body> <div id="main"></div> </body> </html> 그럴 경우 해결 방법은상위 엘리먼트(html, body) 에 높이값을 100%로 지정해 줘야 한다. <style> html, body { height:100%; } div#main { ... } </style>
JS 트리 메뉴 tree menu 샘플
트리구조 메뉴를 만들었다. HTML <html> <head> <title>JS 트리 메뉴 tree menu 샘플</title> </head> <body> <div id="treeMenu"></div> </body> </html> CSS /*tree.js 에 필요한 CSS*/ #treeMenu { position:relative; padding-left:0; } /*Image preLoad*/ #treeMenu::after{ position:absolute;width:0;height:0;overflow:hidde;z-index:-1; content: url(/img/icon_tree_off.gif) url(/img/icon_tree_on.gif) url(/img/icon_tree_tail.gif); } #treeMenu ul{ position:relative; padding-left:12px; list-style:none; } #treeMenu ul li { /* border:solid 1px red; */ } #treeMenu ul … 계속 읽기 JS 트리 메뉴 tree menu 샘플
[ul, li] list-style
<ul> <li>1</li> <li>2</li> <li>3</li> </ul> 위의 코드는 ● 1 ● 2 ● 3 요런식으로 ● 이 생기는데 이걸 없애기 위해선 list-style: none; 을 적용해 주면 된다.
POI 간단 사용법
//간단 엑셀변환 및 스트리밍 다운로드 @RequestMapping(value=”/toExcelNew.do”, method=RequestMethod.POST) public void toExcelNew(HttpServletRequest req, HttpServletResponse res) throws Exception { //엑셀 POI 객체 생성(wookbook → sheet → row → cell) //Keep 100 rows memory, exceeding rows will be flushed to disk SXSSFWorkbook workbook = new SXSSFWorkbook(100); //아래 처럼 해주면 새로운 시트가 생성됨 Sheet sheet = workbook.createSheet(“엑셀시트명”); //가로 3, 세로 … 계속 읽기 POI 간단 사용법
@Autowired private static SqlSession sqlSession
@Autowired private static SqlSession sqlSession이것이 static으로 할 경우 sqlSession이 Null이 될 수 있다.해결방법은 이렇다. private static SqlSession sqlSession; @Autowiredprivate void setSqlSession(SqlSession sqlSession){ this.sqlSession = sqlSession; } static 변수로 선언만 해주고, set메써드를 만들어 @Autowired를 걸어 준다.
브라우저 버전 체크
function isBrowserCheck(){ var agt = navigator.userAgent.toLowerCase(); if (agt.indexOf("chrome") != -1) return 'Chrome'; if (agt.indexOf("opera") != -1) return 'Opera'; if (agt.indexOf("staroffice") != -1) return 'Star Office'; if (agt.indexOf("webtv") != -1) return 'WebTV'; if (agt.indexOf("beonex") != -1) return 'Beonex'; if (agt.indexOf("chimera") != -1) return 'Chimera'; if (agt.indexOf("netpositive") != -1) return 'NetPositive'; if (agt.indexOf("phoenix") != -1) return 'Phoenix'; … 계속 읽기 브라우저 버전 체크
다른 Window(팝업, 부모) POST 전송
자식창에서 부모창으로 POST 전송 <!--자식창에서만 작성--> parent.window.name="parentWindow"; document.form1.submit(); <form name="form1" method="post" action="test.html" target="parentWindow"></form> 팝업창으로 POST 전송 <script> function openwin() { window.open('about:blank','popwin','width=400,height=300'); document.f1.submit(); } </script> <form name="f1" action="popwin.jsp" target="popwin"> <input type="text" name="v1"> <input type="button" value="send" onClick="openwin()"> </form>
자판 입력시 (000-0000-0000)로 자동 치환 : 전화번호, 사업자번호
//전화번호 $("#phone").on("keyup", function(event){ var keyCode = event.which || event.keyCode; if ( ( (keyCode >= 48) || (keyCode <= 57) ) || ( (keyCode >= 96) || (keyCode <= 105) ) ){ var tmp = $(this).val().replace(/[^0-9]/g,''); if(tmp.length<=3){ $(this).val(v.replace(/([0-9]{2})([0-9]+)/,'$1-$2')); }else if(tmp.length<=6){ $(this).val(v.replace(/([0-9]{2})([0-9]{3})([0-9]+)/,'$1-$2-$3')); }else if(tmp.length>9){ $(this).val(v.replace(/([0-9]{3})([0-9]{4})([0-9]+)/,'$1-$2-$3')); } } else { event.returnValue = false; } }); //사업자번호 $("#businessnumber").on("keyup", function(event){ … 계속 읽기 자판 입력시 (000-0000-0000)로 자동 치환 : 전화번호, 사업자번호