52 lines
1.8 KiB
JavaScript
52 lines
1.8 KiB
JavaScript
|
|
/*
|
|
*
|
|
* NLIB 공통 JavaScript
|
|
*
|
|
*
|
|
*/
|
|
|
|
|
|
// 팝업으로 비밀번호를 입력받아서 콜백함수에 전달한다.
|
|
function fn_promptPassword(msg, placeholder, callbackFucName) {
|
|
var options = "top=200, left=200, width=300, height=200, status=no, menubar=no, toolbar=yes, resizable=no";
|
|
var thePrompt = window.open("", "_NLIB_POMPT_PASSWORD", options);
|
|
var theHTML = "<html><head><title>" + placeholder + "</title><style type='text/css'> body { background-color: #ffd; } button { margin: 10px; }</style></head><body>";
|
|
|
|
theHTML += "<p>" + msg + "</p>";
|
|
theHTML += "<br/>";
|
|
theHTML += "비밀번호: <input type='text' id='thePass' placeholder='" + placeholder + "'/>";
|
|
theHTML += " <br />";
|
|
theHTML += " <br />";
|
|
theHTML += "<button title='확인' id='thePromptOk' onclick='opener.parent." + callbackFucName + "("
|
|
+ "document.getElementById(\"thePass\").value); window.close();'>확인</button>";
|
|
theHTML += "<button title='취소' id='thePromptClose' onclick='window.close();'>취소</button>";
|
|
theHTML += "</body></html>";
|
|
|
|
thePrompt.document.body.innerHTML = theHTML;
|
|
}
|
|
|
|
/**
|
|
* ID를 name 으로 하는 객체의 값을 숫자(10진수)로 변환하여 리턴한다.
|
|
* 값이 적절하지 않은 경우, defaultValue를 리턴한다.
|
|
*
|
|
* @param name
|
|
* @param defaultValue
|
|
* @returns
|
|
*/
|
|
function fn_getIntValue(name, defaultValue) {
|
|
var val = $("#" + name).val();
|
|
try {
|
|
return parseInt(val, 10);
|
|
} catch(error) {
|
|
console.error(error);
|
|
return defaultValue;
|
|
}
|
|
}
|
|
|
|
|
|
function openPopup(url, popName, width, height) {
|
|
var options = "top=10, left=10, width=" + (width?width:600) + ", height=" + (height?height:600) + ", status=no, menubar=no, toolbar=yes, resizable=no";
|
|
window.open(url, popName, options);
|
|
}
|