[Dev] FrontEnd/Javascript

var popup; $("#btnPopup").click(function () { if (popup == undefined) { popup = window.open("Popup.aspx", "Test", "top=10, left=20, width=600, height=600"); } else { if (popup.closed) { popup = window.open("Popup.aspx", "Test", "top=10, left=20, width=600, height=600"); } else { alert("이미 팝업창이 떠있습니다."); } } });
자꾸 까먹네. 잊어버리기 전에!! var arr = new Array(); var item1 = new Object(); item1.KeyName1 = value1; item1.KeyName2 = value2; var item2 = new Object(); item2.KeyName1 = value1; item2.KeyName2 = value2; arr_coupon.push(item1); arr_coupon.push(item2); var jsonString = JSON.stringify(arr);
자바스크립트에서 변수명을 일정하게 생성하기 위해서 eval을 열심히 사용했지만 선언되지 않은 변수라고 에러가 팍팍팍팍!!! 결국 구글링신의 힘을 빌려 알아낸 결과. window[] 라는 것을 알게 되었다. 역시 구글!!!! Today I was looking for a decent way to have variable variables in Javascript. Because I work with a whole bunch of particularly bright people*, the answer to any question is always near. I figured I'd share today's little insight! First let's look about how we'd do this i..
그렇게 자주 안쓰는 구문이라 가끔 쓰게 되면 깜빡하게 된다..ㅜㅜ parent : ... ... iframe : ... ... contents ... ... ... iframe 안의 소스에서 내용이 들어가는 전체를 로 감싸고, onload 이벤트로 그 div 의 dom.offsetHeight 를 구해서 parent.iframe 의 height 를 바꿔주는 방식이다. 붉은색으로 표시된 height 가 크로스 브라우징의 핵심이다. 겨우 height 가 핵심이냐고? 모르는 소리다. clientHeight, scrollheight,innerHeight, 등등 모두 크로스브라우징은 안된다. 하지만 그냥 height 는 된다;; 해보면 알게 될것임! 출처 : http://overfloweb.com/zbxe/?mid..
페이지 로딩시 시작할 스크립트 선언에 대해 의 onload를 많이 사용해 보았을 것입니다. 그리고 모든 페이지에서 공통으로 들어갈 스크립트는 페이지 마다 작성을 하지 않고, js 파일을 만들어 연결을 하여 사용을 할 것입니다. 여기서 그럼 모든 페이지에서 load시 공통으로 실행될 스크립트는 어떻게 작업을 할까요?? window.onload를 사용 하면 됩니다. window.onload = function(){ 시작시 실행될 내용 } 이런식으로 말이죠. 그런데 문제는 window.onload와 는 동시에 사용을 할 수 없습니다. 가 실행이 되면 window.onload는 실행이 되지 않는 문제가 있습니다. 그래서 이를 해결하고자 할때 사용하는 것이 window::onload()입니다. function w..
브라우저에 보이는 내용중에서 특정부분만 인쇄하기 위해서 window.onbeforeprint 이벤트에서 출력 직전에 인쇄시 제외할 부분을 정의하고 window.onafterprint 이벤트에서 출력 직후에 제외한 부분을 다시 나타나게 한다. function printReceipt() { window.onbeforeprint = function() { document.getElementById("btnPrint").style.display = "none"; } window.onafterprint = function() { document.getElementById("btnPrint").style.display = "inline"; } window.print(); }
//Error 잡아내기 var isDebugging = true; function ErrorSetting(msg, file_loc, line_no) { var e_msg=msg; var e_file=file_loc; var e_line=line_no; var error_d = "Error in file: " + file_loc + "\nline number:" + line_no + "\nMessage:" + msg; if(isDebugging) alert("Error Found !!!\n--------------\n" + error_d); return true; } window.onerror = ErrorSetting;
if($.browser.msie) { document.getElementById("tr").style.display = "inline"; } else { document.getElementById("tr").style.display = "table-row"; } 익스플로러 7이하에서는 "table-row"의 속성값을 인식하지 못하는 문제가 발생하였다..ㅡㅡ;; 이것은 "inline"으로 설정하면 간단하게 해결이 된다. 하지만 또 다른 문제 발생!!!! 바로 Firefox에서 또 다른 문제가 생긴다. "inline"을 사용하게 되면 첫번째 column에 Table Row가 그냥 생겨버린다. colspan은 전혀 먹히지 않은채~~ 그래서 IE이외의 브라우저는 "table-row" 속성을 먹이면 된다. 아따 ..
JaeYa_Lee
'[Dev] FrontEnd/Javascript' 카테고리의 글 목록