54 lines
2.0 KiB
JavaScript
54 lines
2.0 KiB
JavaScript
/****************************************************************
|
|
*
|
|
* 파일명 : popup
|
|
* 설 명 : 팝업 기능을 처리하는 JavaScript
|
|
*
|
|
* 수정일 수정자 Version Function 명
|
|
* ------------ --------- ------------- ----------------------------
|
|
* 2016.08.05 장동한 1.0 최초생성
|
|
*
|
|
*/
|
|
/* ********************************************************
|
|
* 팝업창 오픈
|
|
******************************************************** */
|
|
function fn_egov_popup(sName, sUrl, width, height){
|
|
|
|
var LeftPosition=(screen.width-width)/2;
|
|
var TopPosition=(screen.height-height)/2;
|
|
|
|
var oPopup = window.open(sUrl,sName,"width="+width+",height="+height+",top="+TopPosition+",left="+LeftPosition+", scrollbars=no");
|
|
if(oPopup){oPopup.focus();}
|
|
}
|
|
|
|
|
|
/* ********************************************************
|
|
* 팝업창 form action + 모니터 가운데 노출
|
|
******************************************************** */
|
|
function openPopupAndSubmitForm(p_targetNm, p_formId, p_width, p_height) {
|
|
var width = p_width; // 팝업 창의 너비
|
|
var height = p_height; // 팝업 창의 높이
|
|
|
|
|
|
|
|
// 화면의 너비와 높이를 가져옵니다.
|
|
var curX = window.screenLeft;
|
|
var curWidth = document.body.clientWidth;
|
|
|
|
// 팝업 창의 x, y 위치를 계산합니다.
|
|
var left = curX + (curWidth / 2) - (width / 2);
|
|
var top = (window.screen.height / 2) - (height / 2);
|
|
|
|
// 팝업 창 설정 및 중앙 위치
|
|
var popup = window.open('', p_targetNm, 'width=' + width + ',height=' + height + ',scrollbars=yes,resizable=yes,left=' + left + ',top=' + top);
|
|
|
|
// form의 target을 새 창으로 설정하고 제출
|
|
var form = document.getElementById(p_formId);
|
|
console.log('p_formId : ', p_formId);
|
|
console.log('form : ', form);
|
|
form.target = p_targetNm;
|
|
form.submit();
|
|
|
|
// 포커스를 새 팝업 창으로 이동
|
|
popup.focus();
|
|
return false;
|
|
} |