var Calendar = Class.create();
Calendar.prototype = {
initialize : function(e, obj) {
this.event = (e) ? e : window.event;
this.obj = obj;
this.today = this.today = new Date();
this.year = this.today.getFullYear();
this.month = this.today.getMonth();
this.date = 1;
this.dayIndex = new Array('일','월','화','수','목','금','토');
this.lastDate = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
this.calWin = window.open('', 'calendar', 'width=200,height=180,top='+(this.event.clientY+100)+',left='+this.event.clientX);
this.makeCal();
},
makeCal : function(type, addSub) {
this.newDate = new Date(this.year, this.month, this.date);
if(type && addSub) {
if(type == 'year') {
if(addSub == 'add') this.newDate.setFullYear(this.newDate.getFullYear()+1); else this.newDate.setFullYear(this.newDate.getFullYear()-1);
} else if(type == 'month') {
if(addSub == 'add') this.newDate.setMonth(this.newDate.getMonth()+1); else this.newDate.setMonth(this.newDate.getMonth()-1);
}
}
this.year = this.newDate.getFullYear();
this.month = this.newDate.getMonth();
this.day = this.newDate.getDay();
if(((this.year%4 == 0) && (this.year%100 != 0)) || (this.year%400 ==0)) {
this.lastDate[1] = 29;
} else {
this.lastDate[1] = 28;
}
_cal = this;
this.calsrc = "<table border='0' cellpadding='0' cellspacing='1' borderColor='#eeeeee' width='100%'>\n";
this.calsrc += "<tr>\n";
this.calsrc += "<td><span onClick=opener._cal.makeCal('year','sub')><<</span> <span onClick=opener._cal.makeCal('month','sub')><</span></td>\n";
this.calsrc += "<td>"+this.newDate.getFullYear()+"년 "+(this.month+1)+"월</td>\n";
this.calsrc += "<td><span onClick=opener._cal.makeCal('month','add')>></span> <span onClick=opener._cal.makeCal('year','add')>>></span></td>\n";
this.calsrc += "</tr>\n";
this.calsrc += "</table>\n";
this.calsrc += "<table border='0' cellpadding='0' cellspacing='1' borderColor='#eeeeee' width='100%'>\n";
this.calsrc += "<tr>\n";
for(i=0; i<this.dayIndex.length; i++) {
this.calsrc += "<td>"+this.dayIndex[i]+"</td>\n";
}
this.calsrc += "</tr>\n";
for(i=0; i<this.day+this.lastDate[this.newDate.getMonth()];i++) {
if(!(i%7)) {
this.calsrc += "</tr>\n";
this.calsrc += "<tr>\n";
}
if(i >= this.day) {
this.calsrc += "<td><span onClick=opener._cal.setDate('"+((i-this.day)+1)+"')>"+((i-this.day)+1)+"</td>\n";
} else {
this.calsrc += "<td></td>\n";
}
}
this.calsrc += "</tr>\n";
this.calsrc += "</table>\n";
this.calWin.document.open();
this.calWin.document.clear();
this.calWin.document.write(this.calsrc);
this.calWin.document.close();
},
fillZero : function(len, value) {
var value = value.toString();
var addLen = len - value.length;
for(i=0; i<addLen; i++) {
value = "0"+value;
}
return value;
},
setDate : function(day) {
$(this.obj).value = this.year+'-'+this.fillZero(2,this.month+1)+'-'+this.fillZero(2,day);
this.calWin.close();
}
}
<input type="text" name="date" id="date'><input type="button" onClick="new Calendar(event, 'date')" value="달력" />
이렇게 사용하면 됩니다.
급조하느라 부족한부분이 많습니다.
Calendar.prototype = {
initialize : function(e, obj) {
this.event = (e) ? e : window.event;
this.obj = obj;
this.today = this.today = new Date();
this.year = this.today.getFullYear();
this.month = this.today.getMonth();
this.date = 1;
this.dayIndex = new Array('일','월','화','수','목','금','토');
this.lastDate = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
this.calWin = window.open('', 'calendar', 'width=200,height=180,top='+(this.event.clientY+100)+',left='+this.event.clientX);
this.makeCal();
},
makeCal : function(type, addSub) {
this.newDate = new Date(this.year, this.month, this.date);
if(type && addSub) {
if(type == 'year') {
if(addSub == 'add') this.newDate.setFullYear(this.newDate.getFullYear()+1); else this.newDate.setFullYear(this.newDate.getFullYear()-1);
} else if(type == 'month') {
if(addSub == 'add') this.newDate.setMonth(this.newDate.getMonth()+1); else this.newDate.setMonth(this.newDate.getMonth()-1);
}
}
this.year = this.newDate.getFullYear();
this.month = this.newDate.getMonth();
this.day = this.newDate.getDay();
if(((this.year%4 == 0) && (this.year%100 != 0)) || (this.year%400 ==0)) {
this.lastDate[1] = 29;
} else {
this.lastDate[1] = 28;
}
_cal = this;
this.calsrc = "<table border='0' cellpadding='0' cellspacing='1' borderColor='#eeeeee' width='100%'>\n";
this.calsrc += "<tr>\n";
this.calsrc += "<td><span onClick=opener._cal.makeCal('year','sub')><<</span> <span onClick=opener._cal.makeCal('month','sub')><</span></td>\n";
this.calsrc += "<td>"+this.newDate.getFullYear()+"년 "+(this.month+1)+"월</td>\n";
this.calsrc += "<td><span onClick=opener._cal.makeCal('month','add')>></span> <span onClick=opener._cal.makeCal('year','add')>>></span></td>\n";
this.calsrc += "</tr>\n";
this.calsrc += "</table>\n";
this.calsrc += "<table border='0' cellpadding='0' cellspacing='1' borderColor='#eeeeee' width='100%'>\n";
this.calsrc += "<tr>\n";
for(i=0; i<this.dayIndex.length; i++) {
this.calsrc += "<td>"+this.dayIndex[i]+"</td>\n";
}
this.calsrc += "</tr>\n";
for(i=0; i<this.day+this.lastDate[this.newDate.getMonth()];i++) {
if(!(i%7)) {
this.calsrc += "</tr>\n";
this.calsrc += "<tr>\n";
}
if(i >= this.day) {
this.calsrc += "<td><span onClick=opener._cal.setDate('"+((i-this.day)+1)+"')>"+((i-this.day)+1)+"</td>\n";
} else {
this.calsrc += "<td></td>\n";
}
}
this.calsrc += "</tr>\n";
this.calsrc += "</table>\n";
this.calWin.document.open();
this.calWin.document.clear();
this.calWin.document.write(this.calsrc);
this.calWin.document.close();
},
fillZero : function(len, value) {
var value = value.toString();
var addLen = len - value.length;
for(i=0; i<addLen; i++) {
value = "0"+value;
}
return value;
},
setDate : function(day) {
$(this.obj).value = this.year+'-'+this.fillZero(2,this.month+1)+'-'+this.fillZero(2,day);
this.calWin.close();
}
}
<input type="text" name="date" id="date'><input type="button" onClick="new Calendar(event, 'date')" value="달력" />
이렇게 사용하면 됩니다.
급조하느라 부족한부분이 많습니다.
[이 게시물은 관리자님에 의해 2011-10-31 16:57:14 JavaScript에서 이동 됨]
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 2030 | 17년 전 | 2800 | ||
| 2029 | 17년 전 | 1605 | ||
| 2028 | 17년 전 | 1352 | ||
| 2027 | 17년 전 | 1611 | ||
| 2026 |
진정한승리
|
17년 전 | 2520 | |
| 2025 | 17년 전 | 1742 | ||
| 2024 | 17년 전 | 2021 | ||
| 2023 | 17년 전 | 1314 | ||
| 2022 |
SE7EN
|
17년 전 | 1051 | |
| 2021 | 17년 전 | 1128 | ||
| 2020 | 17년 전 | 2931 | ||
| 2019 | 17년 전 | 2475 | ||
| 2018 | 17년 전 | 2051 | ||
| 2017 | 17년 전 | 2052 | ||
| 2016 | 17년 전 | 1805 | ||
| 2015 | 17년 전 | 2254 | ||
| 2014 | 17년 전 | 2019 | ||
| 2013 | 17년 전 | 1987 | ||
| 2012 | 17년 전 | 1878 | ||
| 2011 | 17년 전 | 1218 | ||
| 2010 | 17년 전 | 1824 | ||
| 2009 | 17년 전 | 2231 | ||
| 2008 | 17년 전 | 2309 | ||
| 2007 | 17년 전 | 1642 | ||
| 2006 |
Arone
|
17년 전 | 1515 | |
| 2005 |
|
17년 전 | 1364 | |
| 2004 | 17년 전 | 2588 | ||
| 2003 |
suerte
|
17년 전 | 2682 | |
| 2002 |
suerte
|
17년 전 | 2083 | |
| 2001 |
suerte
|
17년 전 | 2425 | |
| 2000 |
|
17년 전 | 2730 | |
| 1999 |
|
17년 전 | 1333 | |
| 1998 |
|
17년 전 | 1199 | |
| 1997 | 17년 전 | 6335 | ||
| 1996 | 17년 전 | 1190 | ||
| 1995 | 17년 전 | 1633 | ||
| 1994 | 17년 전 | 1783 | ||
| 1993 | 17년 전 | 1111 | ||
| 1992 | 17년 전 | 1201 | ||
| 1991 | 17년 전 | 1898 | ||
| 1990 |
sdjsu
|
17년 전 | 1526 | |
| 1989 | 17년 전 | 3625 | ||
| 1988 |
smilesol
|
17년 전 | 1215 | |
| 1987 |
|
17년 전 | 1911 | |
| 1986 | 17년 전 | 1192 | ||
| 1985 | 17년 전 | 1394 | ||
| 1984 | 17년 전 | 2369 | ||
| 1983 | 17년 전 | 2028 | ||
| 1982 | 17년 전 | 1044 | ||
| 1981 | 17년 전 | 1051 | ||
| 1980 | 17년 전 | 1109 | ||
| 1979 |
오렌지76
|
17년 전 | 6055 | |
| 1978 |
오렌지76
|
17년 전 | 5854 | |
| 1977 | 17년 전 | 2042 | ||
| 1976 |
없어씨바라
|
17년 전 | 1034 | |
| 1975 | 17년 전 | 1121 | ||
| 1974 | 17년 전 | 2087 | ||
| 1973 | 17년 전 | 1521 | ||
| 1972 | 17년 전 | 1161 | ||
| 1971 |
smilesol
|
17년 전 | 1201 | |
| 1970 | 17년 전 | 1150 | ||
| 1969 |
smilesol
|
17년 전 | 1070 | |
| 1968 |
소행성블루
|
17년 전 | 3974 | |
| 1967 |
소행성블루
|
17년 전 | 2179 | |
| 1966 | 17년 전 | 1654 | ||
| 1965 |
소행성블루
|
17년 전 | 2781 | |
| 1964 |
고양Ol아빠
|
17년 전 | 1484 | |
| 1963 | 17년 전 | 1172 | ||
| 1962 | 17년 전 | 1191 | ||
| 1961 |
choijinhee
|
17년 전 | 1252 | |
| 1960 | 17년 전 | 1136 | ||
| 1959 | 17년 전 | 1257 | ||
| 1958 |
하이웹솔루션
|
17년 전 | 2411 | |
| 1957 | 17년 전 | 4194 | ||
| 1956 | 17년 전 | 1195 | ||
| 1955 | 17년 전 | 3955 | ||
| 1954 | 17년 전 | 4111 | ||
| 1953 | 17년 전 | 1238 | ||
| 1952 | 17년 전 | 2186 | ||
| 1951 | 17년 전 | 1624 | ||
| 1950 | 17년 전 | 3220 | ||
| 1949 | 17년 전 | 1368 | ||
| 1948 | 17년 전 | 3616 | ||
| 1947 | 17년 전 | 3407 | ||
| 1946 | 17년 전 | 2577 | ||
| 1945 | 17년 전 | 2942 | ||
| 1944 | 17년 전 | 2634 | ||
| 1943 | 17년 전 | 1953 | ||
| 1942 | 17년 전 | 3315 | ||
| 1941 | 17년 전 | 2629 | ||
| 1940 | 17년 전 | 3527 | ||
| 1939 |
|
17년 전 | 1166 | |
| 1938 | 17년 전 | 2251 | ||
| 1937 | 17년 전 | 1327 | ||
| 1936 |
smilesol
|
17년 전 | 1200 | |
| 1935 |
AHEEZII
|
17년 전 | 1065 | |
| 1934 |
smilesol
|
17년 전 | 1044 | |
| 1933 | 17년 전 | 1419 | ||
| 1932 | 17년 전 | 2862 | ||
| 1931 | 17년 전 | 3254 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기