|
![](icon/private_name/1.gif) |
13³â Àü |
// ij¸¯ÅÍ Å¸ÀÔ °ËÁõ 'H'-ÇѱÛ, 'E'-¿µ¹®, 'N'-¼ýÀÚ, 'Z'-±âŸ
function getCharType(pValue){
var bHan = false;
var bAlp = false;
var bNum = false;
var bEtc = false;
var retStr="";
if(isEmpty(pValue)){
return "";
}
for(var idx=0; idx < pValue.length; idx++){
if (isAlpha(pValue[idx])) {
bAlp = true;
}
else if (isNum(pValue[idx])) {
bNum = true;
}
else if (isHangul(pValue[idx])) {
bHan = true;
}
else {
bEtc = true;
}
if (bHan) retStr = retStr + "H";
if (bAlp) retStr = retStr + "E";
if (bNum) retStr = retStr + "N";
if (bEtc) retStr = retStr + "Z";
}
return retStr;
}
//»õâ ¿©´Â ÇÔ¼ö
function uf_newWin( url, winName, sizeW, sizeH)
{
var nLeft = screen.width/2 - sizeW/2 ;
var nTop = screen.height/2 - sizeH/2 ;
opt =
",toolbar=no,menubar=no,Location=no,scrollbars=yes,status=no";
window.open(url, winName, "left=" + nLeft + ",top=" + nTop +
",width=" + sizeW + ",height=" + sizeH
+ opt );
}
//»õâ »çÀÌÁî Á¤ÇÔ
function uf_reSize ( sizeW, sizeH)
{
window.resizeTo!( sizeW, sizeH );
}
//¿É¼ÇÀÌ Àִ°æ¿ì
function selDataChange(form) {
var DataIndex=form.url.selectedIndex;
if (form.url.options[DataIndex].value != null) {
Location=form.url.options[DataIndex].value;
}
}
function selDataChange2(form) {
var DataIndex=form.url2.selectedIndex;
if (form.url2.options[DataIndex].value != null) {
Location=form.url2.options[DataIndex].value;
}
}
/**
* ÀԷ°ªÀÌ NULLÀÎÁö üũ
*/
function isNull(input) {
if (input.value == null || input.value == "") {
return true;
}
return false;
}
/**
* ÀԷ°ª¿¡ ½ºÆäÀ̽º ÀÌ¿ÜÀÇ ÀǹÌÀÖ´Â °ªÀÌ ÀÖ´ÂÁö üũ
* ex) if (isEmpty(form.keyword)) {
* alert!("°Ë»öÁ¶°ÇÀ» ÀÔ·ÂÇϼ¼¿ä.");
* }
*/
function isEmpty(input) {
if (input.value == null || input.value.replace(/ /gi,"") ==
"") {
return true;
}
return false;
}
/**
* ÀԷ°ª¿¡ ƯÁ¤ ¹®ÀÚ(chars)°¡ ÀÖ´ÂÁö üũ
* ƯÁ¤ ¹®ÀÚ¸¦ Çã¿ëÇÏÁö ¾ÊÀ¸·Á ÇÒ ¶§ »ç¿ë
* ex) if (containsChars(form.name,"!,*&^%$#@~;")) {
* alert!("À̸§ Çʵ忡´Â Ư¼ö ¹®ÀÚ¸¦ »ç¿ëÇÒ ¼ö
¾ø½À´Ï´Ù.");
* }
*/
function containsChars(input,chars) {
for (var inx = 0; inx < input.value.length; inx++) {
if (chars.indexOf(input.value.charAt(inx)) != -1)
return true;
}
return false;
}
/**
* ÀԷ°ªÀÌ Æ¯Á¤ ¹®ÀÚ(chars)¸¸À¸·Î µÇ¾îÀÖ´ÂÁö üũ
* ƯÁ¤ ¹®ÀÚ¸¸ Çã¿ëÇÏ·Á ÇÒ ¶§ »ç¿ë
* ex) if (!containsCharsOnly(form.blood,"ABO")) {
* alert!("Ç÷¾×Çü Çʵ忡´Â A,B,O ¹®ÀÚ¸¸ »ç¿ëÇÒ ¼ö
ÀÖ½À´Ï´Ù.");
* }
*/
function containsCharsOnly(input,chars) {
for (var inx = 0; inx < input.value.length; inx++) {
if (chars.indexOf(input.value.charAt(inx)) == -1)
return false;
}
return true;
}
function isStartWith(input,chars) {
for (var inx = 0; inx < chars.length; inx++) {
if (chars.indexOf(input.value.charAt(0)) == -1)
return false;
}
return true;
}
/**
* ÀԷ°ªÀÌ ¾ËÆĺªÀÎÁö üũ
* ¾Æ·¡ isAlphabet() ºÎÅÍ isNumComma()±îÁöÀÇ ¸Þ¼Òµå°¡
* ÀÚÁÖ ¾²ÀÌ´Â °æ¿ì¿¡´Â var chars º¯¼ö¸¦
* global º¯¼ö·Î ¼±¾ðÇÏ°í »ç¿ëÇϵµ·Ï ÇÑ´Ù.
* ex) var uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
* var lowercase = "abcdefghijklmnopqrstuvwxyz";
* var number = "0123456789";
* function isAlphaNum(input) {
* var chars = uppercase + lowercase + number;
* return containsCharsOnly(input,chars);
* }
*/
function isAlphabet(input) {
var chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";
return containsCharsOnly(input,chars);
}
/**
* ÀԷ°ªÀÌ ¾ËÆĺª ´ë¹®ÀÚÀÎÁö üũ
*/
function isUpperCase(input) {
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ ";
return containsCharsOnly(input,chars);
}
/**
* ÀԷ°ªÀÌ ¾ËÆĺª ¼Ò¹®ÀÚÀÎÁö üũ
*/
function isLowerCase(input) {
var chars = "abcdefghijklmnopqrstuvwxyz ";
return containsCharsOnly(input,chars);
}
/**
* ÀԷ°ª¿¡ ¼ýÀÚ¸¸ ÀÖ´ÂÁö üũ
*/
function isNumber(input) {
var chars = "0123456789";
return containsCharsOnly(input,chars);
}
/**
* ÀԷ°ªÀÌ ¾ËÆĺª,¼ýÀÚ·Î µÇ¾îÀÖ´ÂÁö üũ
*/
function isAlphaNum(input) {
var chars =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
";
return containsCharsOnly(input,chars);
}
function isBigAlphaNum(input) {
var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
return containsCharsOnly(input,chars);
}
/**
* ÀԷ°ªÀÌ ¼ýÀÚ,´ë½Ã(-)·Î µÇ¾îÀÖ´ÂÁö üũ
*/
function isNumDash(input) {
var chars = "-0123456789";
return containsCharsOnly(input,chars);
}
/**
* ÀԷ°ªÀÌ ¼ýÀÚ,ÄÞ¸¶(,)·Î µÇ¾îÀÖ´ÂÁö üũ
*/
function isNumComma(input) {
var chars = ",0123456789";
return containsCharsOnly(input,chars);
}
/**
* ÀԷ°ªÀÌ »ç¿ëÀÚ°¡ Á¤ÀÇÇÑ Æ÷¸Ë Çü½ÄÀÎÁö üũ
* ÀÚ¼¼ÇÑ format Çü½ÄÀº ÀÚ¹Ù½ºÅ©¸³Æ®ÀÇ 'regular expression!'À»
ÂüÁ¶
*/
function isValidFormat(input,format) {
if (input.value.search(format) != -1) {
return true; //¿Ã¹Ù¸¥ Æ÷¸Ë Çü½Ä
}
return false;
}
/**
* ÀԷ°ªÀÌ À̸ÞÀÏ Çü½ÄÀÎÁö üũ
* ex) if (!isValidEmail(form.email)) {
* alert!("¿Ã¹Ù¸¥ À̸ÞÀÏ ÁÖ¼Ò°¡ ¾Æ´Õ´Ï´Ù.");
* }
*/
function isValidEmail(input) {
// var format = /^(\S+)@(\S+)\.([A-Za-z]+)$/;
var format = /^((\w|[\-\.])+)@((\w|[\-\.])+)\.([A-Za-z]+)$/;
return isValidFormat(input,format);
}
/**
* ÀԷ°ªÀÌ ÀüȹøÈ£ Çü½Ä(¼ýÀÚ-¼ýÀÚ-¼ýÀÚ)ÀÎÁö üũ
*/
function isValidPhone(input) {
var format = /^(\d+)-(\d+)-(\d+)$/;
return isValidFormat(input,format);
}
/**
* ÀԷ°ªÀÇ ¹ÙÀÌÆ® ±æÀ̸¦ ¸®ÅÏ
* ex) if (getByteLength(form.title) > 100) {
* alert!("Á¦¸ñÀº ÇÑ±Û 50ÀÚ(¿µ¹® 100ÀÚ) ÀÌ»ó ÀÔ·ÂÇÒ ¼ö
¾ø½À´Ï´Ù.");
* }
*/
function getByteLength(input) {
var byteLength = 0;
for (var inx = 0; inx < input.value.length; inx++) {
var oneChar = escape(input.value.charAt(inx));
if ( oneChar.length == 1 ) {
byteLength ++;
} else if (oneChar.indexOf("%u") != -1) {
byteLength += 2;
} else if (oneChar.indexOf("%") != -1) {
byteLength += oneChar.length/3;
}
}
return byteLength;
}
/**
* ÀԷ°ª¿¡¼ ÄÞ¸¶¸¦ ¾ø¾Ø´Ù.
*/
function removeComma(input) {
return input.value.replace(/,/gi,"");
}
/**
* ¼±ÅÃµÈ ¶óµð¿À¹öÆ°ÀÌ ÀÖ´ÂÁö üũ
*/
function hasCheckedRadio(input) {
if (input.length > 1) {
for (var inx = 0; inx < input.length; inx++) {
if (input[inx].checked) return true;
}
} else {
if (input.checked) return true;
}
return false;
}
/**
* ¼±ÅÃµÈ Ã¼Å©¹Ú½º°¡ ÀÖ´ÂÁö üũ
*/
function hasCheckedBox(input) {
return hasCheckedRadio(input);
}
/**
* ¼±ÅÃµÈ Ã¼Å©¹Ú½º°¡ ¸î°³ÀÎÁö ±× °³¼ö¸¦ ¹Ýȯ
*/
function hasMultiCheckedRadio(input) {
var kkkk = 0;
if (input.length > 1) {
for (var inx = 0; inx < input.length; inx++) {
if (input[inx].checked) {
kkkk++;
}
}
} else {
if (input.checked) kkkk=1;
}
return kkkk;
}
/**
* À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ¿ù(êÅ)ÀÎÁö üũ
*/
function isValidMonth(mm) {
var m = parseInt(mm,10);
return (m >= 1 && m <= 12);
}
/**
* À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ÀÏ(ìí)ÀÎÁö üũ
*/
function isValidDay(yyyy, mm, dd) {
var m = parseInt(mm,10) - 1;
var d = parseInt(dd,10);
var end = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
if ((yyyy % 4 == 0 && yyyy % 100 != 0) || yyyy % 400 == 0) {
end[1] = 29;
}
return (d >= 1 && d <= end[m]);
}
/**
* À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ½Ã(ãÁ)ÀÎÁö üũ
*/
function isValidHour(hh) {
var h = parseInt(hh,10);
return (h >= 1 && h <= 24);
}
/**
* À¯È¿ÇÑ(Á¸ÀçÇÏ´Â) ºÐ(ÝÂ)ÀÎÁö üũ
*/
function isValidMin(mi) {
var m = parseInt(mi,10);
return (m >= 1 && m <= 60);
}
/**
* Time Çü½ÄÀÎÁö üũ(´À½¼ÇÑ Ã¼Å©)
*/
function isValidTimeFormat(time) {
return (!isNaN(time) && time.length == 12);
}
/**
* À¯È¿ÇÏ´Â(Á¸ÀçÇÏ´Â) Time ÀÎÁö üũ
* ex) var time = form.time.value; //'200102310000'
* if (!isValidTime(time)) {
* alert!("¿Ã¹Ù¸¥ ³¯Â¥°¡ ¾Æ´Õ´Ï´Ù.");
* }
*/
function isValidTime(time) {
var year = time.substring(0,4);
var month = time.substring(4,6);
var day = time.substring(6,8);
var hour = time.substring(8,10);
var min = time.substring(10,12);
if (parseInt(year,10) >= 1900 && isValidMonth(month) &&
isValidDay(year,month,day) && isValidHour(hour) &&
isValidMin(min)) {
return true;
}
return false;
}
/**
* Time ½ºÆ®¸µÀ» ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼·Î º¯È¯
* parameter time: Time Çü½ÄÀÇ String
*/
function toTimeObject(time) { //parseTime(time)
var year = time.substr(0,4);
var month = time.substr(4,2) - 1; // 1¿ù=0,12¿ù=11
var day = time.substr(6,2);
var hour = time.substr(8,2);
var min = time.substr(10,2);
return new Date(year,month,day,hour,min);
}
/**
* ÀÚ¹Ù½ºÅ©¸³Æ® Date °´Ã¼¸¦ Time ½ºÆ®¸µÀ¸·Î º¯È¯
* parameter date: JavaScript Date Object
*/
function toTimeString(date) { //formatTime(date)
var year = date.getFullYear();
var month = date.getMonth() + 1; // 1¿ù=0,12¿ù=11À̹ǷΠ1
´õÇÔ
var day = date.getDate();
var hour = date.getHours();
var min = date.getMinutes();
if (("" + month).length == 1) { month = "0" + month; }
if (("" + day).length == 1) { day = "0" + day; }
if (("" + hour).length == 1) { hour = "0" + hour; }
if (("" + min).length == 1) { min = "0" + min; }
return ("" + year + month + day + hour + min)
}
/**
* TimeÀÌ ÇöÀç½Ã°¢ ÀÌÈÄ(¹Ì·¡)ÀÎÁö üũ
*/
function isFutureTime(time) {
return (toTimeObject(time) > new Date());
}
/**
* TimeÀÌ ÇöÀç½Ã°¢ ÀÌÀü(°ú°Å)ÀÎÁö üũ
*/
function isPastTime(time) {
return (toTimeObject(time) < new Date());
}
/**
* ÁÖ¾îÁø Time °ú y³â m¿ù dÀÏ h½Ã Â÷À̳ª´Â TimeÀ» ¸®ÅÏ
* ex) var time = form.time.value; //'20000101000'
* alert!(shiftTime(time,0,0,-100,0));
* => 2000/01/01 00:00 À¸·ÎºÎÅÍ 100ÀÏ Àü Time
*/
function shiftTime(time,y,m,d,h) { //moveTime(time,y,m,d,h)
var date = toTimeObject(time);
date.setFullYear(date.getFullYear() + y); //y³âÀ» ´õÇÔ
date.setMonth(date.getMonth() + m); //m¿ùÀ» ´õÇÔ
date.setDate(date.getDate() + d); //dÀÏÀ» ´õÇÔ
date.setHours(date.getHours() + h); //h½Ã¸¦ ´õÇÔ
return toTimeString(date);
}
/**
* µÎ TimeÀÌ ¸î °³¿ù Â÷À̳ª´ÂÁö ±¸ÇÔ
* time1ÀÌ time2º¸´Ù Å©¸é(¹Ì·¡¸é) minus(-)
*/
function getMonthInterval(time1,time2) {
//measureMonthInterval(time1,time2)
var date1 = toTimeObject(time1);
var date2 = toTimeObject(time2);
var years = date2.getFullYear() - date1.getFullYear();
var months = date2.getMonth() - date1.getMonth();
var days = date2.getDate() - date1.getDate();
return (years * 12 + months + (days >= 0 ? 0 : -1) );
}
/**
* µÎ TimeÀÌ ¸çÄ¥ Â÷À̳ª´ÂÁö ±¸ÇÔ
* time1ÀÌ time2º¸´Ù Å©¸é(¹Ì·¡¸é) minus(-)
*/
function getDayInterval(time1,time2) {
var date1 = toTimeObject(time1);
var date2 = toTimeObject(time2);
var day = 1000 * 3600 * 24; //24½Ã°£
return parseInt((date2 - date1) / day, 10);
}
/**
* µÎ TimeÀÌ ¸î ½Ã°£ Â÷À̳ª´ÂÁö ±¸ÇÔ
* time1ÀÌ time2º¸´Ù Å©¸é(¹Ì·¡¸é) minus(-)
*/
function getHourInterval(time1,time2) {
var date1 = toTimeObject(time1);
var date2 = toTimeObject(time2);
var hour = 1000 * 3600; //1½Ã°£
return parseInt((date2 - date1) / hour, 10);
}
/**
* ÇöÀç ½Ã°¢À» Time Çü½ÄÀ¸·Î ¸®ÅÏ
*/
function getCurrentTime() {
return toTimeString(new Date());
}
/**
* ÇöÀç ½Ã°¢°ú y³â m¿ù dÀÏ h½Ã Â÷À̳ª´Â TimeÀ» ¸®ÅÏ
*/
function getRelativeTime(y,m,d,h) {
return shiftTime(getCurrentTime(),y,m,d,h);
}
/**
* ÇöÀç Ò´À» YYYYÇü½ÄÀ¸·Î ¸®ÅÏ
*/
function getYear() {
return getCurrentTime().substr(0,4);
}
/**
* ÇöÀç êÅÀ» MMÇü½ÄÀ¸·Î ¸®ÅÏ
*/
function getMonth() {
return getCurrentTime().substr(4,2);
}
/**
* ÇöÀç ìíÀ» DDÇü½ÄÀ¸·Î ¸®ÅÏ
*/
function getDay() {
return getCurrentTime().substr(6,2);
}
/**
* ÇöÀç ãÁ¸¦ HHÇü½ÄÀ¸·Î ¸®ÅÏ
*/
function getHour() {
return getCurrentTime().substr(8,2);
}
/**
* ¿À´ÃÀÌ ¹«½¼ ¿äÀÏÀ̾ß?
* ex) alert!('¿À´ÃÀº ' + getDayOfWeek() + '¿äÀÏÀÔ´Ï´Ù.');
*/
function getDayOfWeek() {
var now = new Date();
var day = now.getDay(); //ÀÏ¿äÀÏ=0,¿ù¿äÀÏ=1,...,Åä¿äÀÏ=6
var week = new Array('ÀÏ','¿ù','È','¼ö','¸ñ','±Ý','Åä');
return week[day];
}
/**
* ƯÁ¤³¯Â¥ÀÇ ¿äÀÏÀ» ±¸ÇÑ´Ù.
*/
function getDayOfWeek(time) {
var now = toTimeObject(time);
var day = now.getDay(); //ÀÏ¿äÀÏ=0,¿ù¿äÀÏ=1,...,Åä¿äÀÏ=6
var week = new Array('ÀÏ','¿ù','È','¼ö','¸ñ','±Ý','Åä');
return week[day];
}
/**
* ¹®ÀÚ¿ÀÇ ¿À¸¥ÂÊ ³¡¿¡¼ ºÎÅÍ ÁöÁ¤µÈ °³¼ö¸¸ÅÀÇ ¹®ÀÚµéÀ»
¸®ÅÏÇÑ´Ù.
*/
function substrInverse(str, num)
{
var len;
len = str.length;
return str.substr(len - num, num);
}
/**
* ¹®ÀÚ¿·ÎÀÇ Æ¯Á¤À§Ä¡·ÎºÎÅÍ ÁöÁ¤µÈ °³¼öÀÇ ¹®ÀÚµéÀ» ¸®ÅÏÇÑ´Ù.
*/
function substrMid(str, idx, num)
{
return str.substr( idx-1, num);
}
/**
* Cookie¼³Á¤Çϱâ
*/
function setCookie(name, value, expire) {
document.cookie! = name + "=" + escape(value)
+ ( (expire) ? "; expires=" + expire.toGMTString() :
"")
}
/**
* Cookie ±¸Çϱâ
*/
function getCookie(uName) {
var flag = document.cookie!.indexOf(uName+'=');
if (flag != -1) {
flag += uName.length + 1
end = document.cookie!.indexOf(';', flag)
if (end == -1) end = document.cookie!.length
return UNESCAPE(document.cookie!.substring(flag, end))
}
}
function Half2Full(HalfVal)
{
var arg;
arg = myHalf2Full(HalfVal);
return arg;
}
function myHalf2Full(HalfVal)
{
var FullChar = [
"¡¡", "£¡","£¢","££","£¤","£¥","£¦","£§","£¨",
//33~
"£©","£ª","£«","£¬","£","£®","£¯","£°","£±","£²",
//41~
"£³","£´","£µ","£¶","£·","£¸","£¹","£º","£»","£¼",
//51~
"£½","£¾","£¿","£À","£Á","£Â","£Ã","£Ä","£Å","£Æ",
//61~
"£Ç","£È","£É","£Ê","£Ë","£Ì","£Í","£Î","£Ï","£Ð",
//71~
"£Ñ","£Ò","£Ó","£Ô","£Õ","£Ö","£×","£Ø","£Ù","£Ú",
//81~
"£Û","£Ü","£Ý","£Þ","£ß","£à","£Á","£Â","£Ã","£Ä",
//91~
"£Å","£Æ","£Ç","£È","£É","£Ê","£Ë","£Ì","£Í","£Î",
//101~
"£Ï","£Ð","£Ñ","£Ò","£Ó","£Ô","£Õ","£Ö","£×","£Ø",
//111~
"£Ù","£Ú","£û","£ü","£ý","¢¦"
//121~
];
var stFinal = "";
var ascii;
for( i = 0; i < HalfVal.length; i++)
{
ascii = HalfVal.charCodeAt(i);
if( (31 < ascii && ascii < 128))
{
stFinal += FullChar[ascii-32];
}
else
{
stFinal += HalfVal.charAt(i);
}
}
return stFinal;
}
function frmMoney(input){
input.value = putComma(input);
}
function unFrmMoney(input){
input.value = replace(input.value,",","");
}
function frmDate(input){
if(input.value=="") return
input.value = input.value.substring(0,4) + "-" +
input.value.substring(4,6) + "-" + input.value.substring
(6,8);
}
function unFrmDate(input){
input.value = replace(input.value,"-","");
}
function frmTime(input){
input.value = input.value.substring(0,2) + ":" +
input.value.substring(2,4) + ":" + input.value.substring
(4,6);
}
function unFrmTime(input){
input.value = replace(input.value,":","");
}
function frmAcct(input){
input.value = input.value.substring(0,3) + "-" +
input.value.substring(3,9) + "-" + input.value.substring
(9,14);
}
function unFrmAcct(input){
input.value = replace(input.value,"-","");
}
function setSelect(input,str) {
for(i=0;i<input.options.length;i++){
if(input.options[i].value == str)
input.options[i].selected=true;
}
}
// ¿Üȯ¿¡¼ ƯÁ¤ ÅëÈÀ϶§ ¼Ò¼öÁ¡ÀÌÇÏ ±Ý¾×¾ø¾Ö±â
function Curr(str1, str2){
obj1 = eval!("frm."+str1+".value")
obj2 = eval!("frm."+str2+".style")
if(obj1=="JPY"||obj1=="ITL"||obj1=="BEF"||obj1=="KRW"){
obj2.display = "none"
}else{
obj2.display = ""
}
}
function Curr2(str1, str2, str3){
obj1 = eval!("frm."+str1+".value")
obj2 = eval!("frm."+str2+".style")
obj3 = eval!("frm."+str3+".style")
if(obj1=="JPY"||obj1=="ITL"||obj1=="BEF"||obj1=="KRW"){
obj2.display = "none"
obj3.display = "none"
}else{
obj2.display = ""
obj3.display = ""
}
}
////////////////////////////////////////////////////////////////
// µ¥ÀÌÅÍ Àü¼ÛÇüÅ °ü·Ã
////////////////////////////////////////////////////////////////
// get ¹æ½ÄÀÇ ÆĶó¹ÌÅ͸¦ ÇØ´çÆû¿¡ input hidden °´Ã¼·Î
»ý¼ºÇÑ´Ù.
function get2post(frm,sSearch){
if (sSearch.length > 0) {
var asKeyValues = sSearch.split('&');
var asKeyValue = '';
for (var i = 0; i < asKeyValues.length; i++) {
asKeyValue = asKeyValues[i].split('=');
var e = document.createElement("input");
e.setAttribute("type","hidden");
e.setAttribute("name",asKeyValue[0]);
e.setAttribute("value",asKeyValue[1]);
e.setAttribute("_temp","true");
// alert!("[" + e.name +"]:[" + e.value +"]");
frm.appendChild(e);
}
}
// alert!("form °´Ã¼ °¹¼ö" + frm.elements.length);
}
// get2post·Î »ý¼ºÇÑ Àӽà °´Ã¼¸¦ Æı«ÇÑ´Ù.
function removeTempAttribute(frm){
var idx=0;
while (idx<frm.elements.length) {
var obj = frm.elements[idx];
if( obj.getAttribute("_temp") != null &&
obj.getAttribute("_temp") == "true"){
frm.removeChild(obj);
continue;
}
idx++;
}
}
////////////////////////////////////////////////////////////////
// checkbox °ü·Ã
////////////////////////////////////////////////////////////////
// check ÇÑ °³¼ö¸¦ ¸®ÅÏÇÑ´Ù.
function getCheckedCount( aElem ) {
var elem = document.all;
var cnt = 0;
for ( var i=0; i<document.all.length; i++ ) {
if ( ( elem[i].type == "checkbox" ) && ( elem[i].checked )
&& ( elem[i].name == aElem ) ) cnt =
cnt + 1;
}
return cnt;
}
// ÁöÁ¤ÇÑ À̸§À» °¡Áø ¸ðµç checkbox¸¦ check ÇÑ´Ù.
function checkAll( aElem ) {
var elem = document.all;
var cnt = 0;
for ( var i=0; i<document.all.length; i++ ) {
if ( ( elem[i].type == "checkbox" ) && ( elem[i].name ==
aElem ) ) elem[i].checked = true;
}
}
// ÁöÁ¤ÇÑ À̸§À» °¡Áø ¸ðµç checkboxÀÇ checked °ªÀ» ¹ÝÀü ÇÑ´Ù.
function invertCheck( aElem ) {
var elem = document.all;
var cnt = 0;
for ( var i=0; i<document.all.length; i++ ) {
if ( ( elem[i].type == "checkbox" ) && ( elem[i].name ==
aElem ) ) {
if ( elem[i].checked ) {
elem[i].checked = false;
}
else{
elem[i].checked = true;
}
}
}
}
////////////////////////////////
// UTIL ÇÔ¼ö
////////////////////////////////
var isDivEvent = false;
function hideOneNav(){
if (!isDivEvent) {
window.account.style.visibility='hidden';
}
else{
isDivEvent = false;
}
}
function showOneNav(obj){
isDivEvent = true;
window.account.style.left = getLeftPos(obj);
window.account.style.top = getTopPos(obj) + obj.offsetHeight
- 8;
window.account.style.visibility='visible';
return false;
}
function getLeftPos(obj){
var parentObj = null;
var clientObj = obj;
var left = obj.offsetLeft + document.body.clientLeft;
while((parentObj=clientObj.offsetParent) != null){
left = left + parentObj.offsetLeft;
clientObj = parentObj;
}
return left;
}
function getTopPos(obj){
var parentObj = null;
var clientObj = obj;
var top = obj.offsetTop + document.body.clientTop;
while((parentObj=clientObj.offsetParent) != null){
top = top + parentObj.offsetTop;
clientObj = parentObj;
}
return top;
}
/**
* ¹®ÀÚ¿¿¡ Àִ ƯÁ¤¹®ÀÚÆÐÅÏÀ» ´Ù¸¥ ¹®ÀÚÆÐÅÏÀ¸·Î ¹Ù²Ù´Â
ÇÔ¼ö.
*/
function replace(targetStr, searchStr, replaceStr)
{
var len, i, tmpstr;
len = targetStr.length;
tmpstr = "";
for ( i = 0 ; i < len ; i++ ) {
if ( targetStr.charAt(i) != searchStr ) {
tmpstr = tmpstr + targetStr.charAt(i);
}
else {
tmpstr = tmpstr + replaceStr;
}
}
return tmpstr;
}
/**
* ¹®ÀÚ¿¿¡¼ ÁÂ¿ì °ø¹éÁ¦°Å
*/
function trim(str)
{
return replace(str," ","");
}
/**
* ÄÞ¸¶¼³Á¤.
*/
function putComma(input) {
var num = input;
if (num < 0) {
num *= -1;
var minus = true
}else{
var minus = false
}
var dotPos = (num+"").split(".")
var dotU = dotPos[0]
var dotD = dotPos[1]
var commaFlag = dotU.length%3
if(commaFlag) {
var out = dotU.substring(0, commaFlag)
if (dotU.length > 3) out += ","
}
else var out = ""
for (var i=commaFlag; i < dotU.length; i+=3) {
out += dotU.substring(i, i+3)
if( i < dotU.length-3) out += ","
}
if(minus) out = "-" + out
if(dotD) return out + "." + dotD
else return out
}
//¿ùÀÇ ³¡ ÀÏÀÚ ¾ò±â
function getEndDate(datestr){
//³ÎÀÎÁö?
if(isEmpty(datestr)){
return null;
}
//¼ýÀÚÀÎÁö?
if(!isNum(datestr)){
return null;
}
//±æÀÌ°¡ 8ÀÚ¸®?
if(datestr.length != 6){
return null;
}
var yy = Number(datestr.substring(0,4));
var mm = Number(datestr.substring(4,6));
//À±³â °ËÁõ
var boundDay = "";
if(mm != 2){
var mon=new Array(31,28,31,30,31,30,31,31,30,31,30,31);
boundDay = mon[mm-1];
}
else{
if (yy%4 == 0 && yy%100 != 0 || yy%400 == 0){
boundDay = 29;
}
else{
boundDay = 28;
}
}
return boundDay;
}
// Left ºóÀÚ¸® ¸¸Å padStr À» ºÙÀδÙ.
function lpad(src, len, padStr){
var retStr = "";
var padCnt = Number(len) - String(src).length;
for(var i=0;i<padCnt;i++) retStr += String(padStr);
return retStr+src;
}
// Right ºóÀÚ¸® ¸¸Å padStr À» ºÙÀδÙ.
function rpad(src, len, padStr){
var retStr = "";
var padCnt = Number(len) - String(src).length;
for(var i=0;i<padCnt;i++) retStr += String(padStr);
return src+retStr;
}
// ÀüȹøÈ£ ±¹¹ø°ËÁõ
function isValidDDDPhoneNum(dddphonenum)
{
// ³ÎÀΰ¡?
if (isEmpty(dddphonenum)) {
return null;
}
if ( dddphonenum != "02" && dddphonenum != "031" &&
dddphonenum != "032" && dddphonenum !
= "033" && dddphonenum != "041" &&
dddphonenum != "042" && dddphonenum != "043" &&
dddphonenum != "051" && dddphonenum !
= "052" && dddphonenum != "053" &&
dddphonenum != "054" && dddphonenum != "055" &&
dddphonenum != "061" && dddphonenum !
= "062" && dddphonenum != "063" &&
dddphonenum != "064" && dddphonenum != "011" &&
dddphonenum != "016" && dddphonenum !
= "017" && dddphonenum != "018" && dddphonenum != "019" )
{
ERR_MSG = "À߸øµÈ ÀüȹøÈ£ ±¹¹øÀÔ´Ï´Ù.";
return false;
}
return true;
}
// ´ë¹®ÀÚº¯È¯
function toUpperCase(str){
if(isEmpty(str)) return str;
return str.toUpperCase();
}
// ¼ýÀÚ°ËÁõ
function isNum(str){
if(isEmpty(str)) return false;
for(var idx=0;idx < str.length;idx++){
if(str.charAt(idx) < '0' || str.charAt(idx) > '9'){
return false;
}
}
return true;
}
// ¿µ¹®ÀÚ°ËÁõ
function isAlpha(str){
if(isEmpty(str)) return false;
for(var idx=0;idx < str.length;idx++){
if(!((str.charAt(idx) >='a' && str <= 'z') ||
(str.charAt(idx) >= 'A' && str <= 'Z'))){
return false;
}
}
return true;
}
// Çѱ۰ËÁõ
function isHangul(str){
if(isEmpty(str)) return false;
for(var idx=0;idx < str.length;idx++){
var c = escape(str.charAt(idx));
if ( c.indexOf("%u") == -1 ) {
return false;
}
}
return true;
}
// ½ÇÁ¦±æÀÌ ¹Ýȯ( ÇÑ±Û 2byte °è»ê )
function getByteLength(s){
var len = 0;
if ( s == null ) return 0;
for(var i=0;i<s.length;i++){
var c = escape(s.charAt(i));
if ( c.length == 1 ) len ++;
else if ( c.indexOf("%u") != -1 ) len += 2;
else if ( c.indexOf("%") != -1 ) len += c.length/3;
}
return len;
}
// ºó°ªÀÎÁö ¸®ÅÏÇÑ´Ù.
function isEmpty(pValue){
if( (pValue == "") || (pValue == null) ){
return true;
}
return false;
}
//°Ë»ö³¯Â¥ À¯È¿±â°£
function getBoundDate1(yy,mm,dd,stdDate)
{
var today = new Date();
today.setYear(stdDate.substring(0,4));
today.setMonth(stdDate.substring(4,6)-1);
today.setDate(stdDate.substring(6,8));
today.setHours(today.getHours());
today.setMinutes(today.getMinutes());
today.setSeconds(today.getSeconds());
yy = Number(yy);
mm = Number(mm);
dd = Number(dd);
var date = new Date();
var DAY = 24 * 60 * 60 * 1000;
if ( yy != 0 ){
date.setTime(today.getTime() + DAY * 365 * yy);
}
if ( mm != 0 ){
date.setTime(today.getTime() + DAY * 30 * mm);
}
if ( dd != 0 ){
date.setTime(today.getTime() + DAY * dd);
}
return lpad(new String(date.getYear()),4,'0') + lpad(new
String(date.getMonth() + 1),2,'0') + lpad
(new String(date.getDate()),2,'0');
}
function getBoundDate(yy, mm, dd) {
yy = Number(yy);
mm = Number(mm);
dd = Number(dd);
var date = new Date();
var DAY = 24 * 60 * 60 * 1000;
if ( yy != 0 ){
date.setTime(datToday.getTime() + DAY * 365 * yy);
}
if ( mm != 0 ){
date.setTime(datToday.getTime() + DAY * 30 * mm);
}
if ( dd != 0 ){
date.setTime(datToday.getTime() + DAY * dd);
}
return lpad(new String(date.getYear()),4,'0') + lpad(new
String(date.getMonth() + 1),2,'0') + lpad
(new String(date.getDate()),2,'0');
}
//°Ë»ö³¯Â¥ üũ
function isVaildTerm(obj,yy,mm,dd)
{
var datestr = obj.value;
//³ÎÀÎÁö?
if(isEmpty(datestr)){
return null;
}
// ³¯Â¥ Æ÷¸ËÁ¦°Å
obj_removeformat(obj);
//8ÀÚ¸®ÀÎÁö?
if (getByteLength(datestr) != 8) {
alert!("³¯Â¥´Â '-'¸¦ Á¦¿ÜÇÑ 8ÀÚ¸® ¼ýÀÚ·Î ÀÔ·ÂÇϽʽÿÀ.");
return false;
}
// yy,mm,dd,fromto°¡ ¾øÀ» °æ¿ì
if (yy == null) yy = 0;
if (mm == null) mm = 0;
if (dd == null) dd = 0;
// °Ë»ö³¯Â¥ À¯È¿±â°£ °¡Á®¿À±â
var boundDate = getBoundDate(yy,mm,dd);
if (yy < 0 || mm < 0 || dd < 0) {
if ( boundDate > datestr) {
alert!("À¯È¿ÇÏÁö ¾ÊÀº °Ë»ö³¯Â¥ÀÔ´Ï´Ù.\nÀ¯È¿ÇÑ ³¯Â¥´Â" +
boundDate.substring(0,4) + "³â " +
boundDate.substring(4,6) + "¿ù " + boundDate.substring(6) +
"ÀϺÎÅÍ ÀÔ´Ï´Ù.");
obj.select();
return false;
}
} else {
if ( boundDate < datestr) {
alert!("À¯È¿ÇÏÁö ¾ÊÀº °Ë»ö³¯Â¥ÀÔ´Ï´Ù.\nÀ¯È¿ÇÑ ³¯Â¥´Â" +
boundDate.substring(0,4) + "³â " +
boundDate.substring(4,6) + "¿ù " + boundDate.substring(6) +
"ÀϱîÁö ÀÔ´Ï´Ù.");
obj.select();
return false;
}
}
return true;
}
//¿À´Ã³¯Â¥
function getToDay()
{
var date = datToday;
var year = date.getFullYear();
var month = date.getMonth() + 1; // 1¿ù=0,12¿ù=11À̹ǷΠ1
´õÇÔ
var day = date.getDate();
if (("" + month).length == 1) { month = "0" + month; }
if (("" + day).length == 1) { day = "0" + day; }
return ("" + year + month + day)
}
function selectComboBox(targt, optValue)
{
last = targt.length;
for(var i=0; i<last; i++){
if(targt.options[i].value == optValue){
targt.selectedIndex = i;
targt.options[i].selected;
}
}
}
function isExistsComboBoxValue(targt, optValue)
{
last = targt.length;
for(var i=0; i<last; i++){
if(targt.options[i].value == optValue){
return true;
}
}
return false;
}
function getCal(aFrm, aObj){
window.open('/kor/ib/common/msg/cal.jsp?objName=window.opener.'+
aFrm.name +'.' +
aObj.name +'&schdate='+ aFrm.name +'.' +
aObj.name
,"Window2","status=no,height=150,width=120,resizable=no,left="+x+
",top="+y+",scrollbars=no
");
}
function getCalMonth(aFrm, aObj){
window.open("/kor/ib/common/msg/calendar_month.jsp?frmName="+aFrm
.name + "&obj=" +
aObj.name,"calMonth","status=no,height=146,width=255,resizable=no
,left="+x+",top="+y+",scrollbars=no
");
}
/*
* ÀüȹøÈ£
* ¾Õ¿¡ '0'À» ä¿î´Ù
* by Ȳ»óÈÆ 2002-10-23 11:26¿ÀÈÄ
**/
function fill_zero(obj, is4){
var temp="";
if(obj.value == null || obj.value.length < 1 ) {
return false;
}
if (is4 == 'Y' ) {
return true;
} else {
if(obj.value.length != 4 ) {
for(i=0;i<(4-obj.value.length);i++){
temp +="0";
}
obj.value = temp+obj.value;
}else{
obj.value = obj.value;
}
return true;
}
}
|
|
̵̧ : 215 |
̵̧
¸ñ·Ï
|
|