var cal;
var isFocus=false; //Whether it is the focus
var pickMode ={
"second":1,
"minute":2,
"hour":3,
"day":4,
"month":5,
"year":6 };
var topY=0,leftX=0; / /Custom positioning offset 2007-02-11 Added by Han Yufeng
//Select date → Added by Han Yufeng 2007-06-10, select date by ID
function SelectDateById(id,strFormat ,x,y)
{
var obj = document.getElementById(id);
if(obj == null){return false;}
obj.focus();
if (obj.onclick != null){obj.onclick();}
else if(obj.click != null){obj.click();}
else{SelectDate(obj,strFormat,x, y)}
}
//Select date→ Added by Han Yufeng 2006-06-25
function SelectDate(obj,strFormat,x,y)
{
leftX =(x == null) ? leftX : x;
topY =(y == null) ? topY : y; // Custom positioning offset 2007-02-11 Added by Han Yufeng
if(document.getElementById("ContainerPanel")==null){InitContainerPanel();}
var date = new Date();
var by = date.getFullYear()-50; //Min. Value→ 50 years ago
var ey = date.getFullYear() 50; //Maximum value→ 50 years later
//cal = new Calendar(by, ey,1,strFormat); //Initialize English version , 0 is the Chinese version
cal = (cal==null) ? new Calendar(by, ey, 0) : cal; //No need to initialize every time2006-12-03 Correction
cal.DateMode =pickMode ["second"]; //Reset
if(strFormat.indexOf('s')< 0) {cal.DateMode =pickMode["minute"];}//The precision is minutes
if(strFormat .indexOf('m')< 0) {cal.DateMode =pickMode["hour"];}//The precision is time
if(strFormat.indexOf('h')< 0) {cal.DateMode =pickMode["day"];}//The precision is day
if(strFormat.indexOf('d')< 0) {cal.DateMode =pickMode["month"];}//The precision is month
if(strFormat.indexOf('M')< 0) {cal.DateMode =pickMode["year"];}//The precision is year
if(strFormat.indexOf('y')< 0 ) {cal.DateMode =pickMode["second"];}//The default precision is seconds
cal.dateFormatStyleOld = cal.dateFormatStyle;
cal.dateFormatStyle = strFormat;
cal.show(obj);
}
/**//**//**//**//**
* Return date
* @param d the delimiter
* @param p the pattern of your date
2006-06-25 Modified by Han Yufeng to the style specified by the user to confirm;
*//**//**//**
* Return Date
* @param d the delimiter
* @param p the pattern of your date
2006-06-25 Modified by Han Yufeng to be determined based on the style specified by the user;
*/
String.prototype.toDate = function(style) {
var y = this.substring(style.indexOf('y'),style.lastIndexOf('y') 1);//year
var M = this.substring(style .indexOf('M'),style.lastIndexOf('M') 1);//month
var d = this.substring(style.indexOf('d'),style.lastIndexOf('d') 1 );//Day
var h = this.substring(style.indexOf('h'),style.lastIndexOf('h') 1);//Time
var m = this.substring(style. indexOf('m'),style.lastIndexOf('m') 1);//point
var s = this.substring(style.indexOf('s'),style.lastIndexOf('s') 1) ;//Seconds
if(s == null ||s == "" || isNaN(s)) {s = new Date().getSeconds();}
if(m = = null ||m == "" || isNaN(m)) {m = new Date().getMinutes();}
if(h == null ||h == "" || isNaN(h )) {h = new Date().getHours();}
if(d == null ||d == "" || isNaN(d)) {d = new Date().getDate(); }
if(M == null ||M == "" || isNaN(M)) {M = new Date().getMonth() 1;}
if(y == null ||y == "" || isNaN(y)) {y = new Date().getFullYear();}
var dt ;
eval ("dt = new Date('" y "', '" ( M-1) "','" d "','" h "','" m "','" s "')");
return dt;
}
/**//**
* Format date
* @param d the delimiter
* @param p the pattern of your date
* @author meizz
*<🎝>*<🎝>*<🎝>*<🎝>*<🎝>*<🎝>*
* Format date
* @param d the delimiter
* @param p the pattern of your date
* @author meizz
*/
Date.prototype.format = function(style) {
var o = {
"M " : this .getMonth() 1, //month
"d " : this.getDate(), //day
"h " : this.getHours(), //hour
"m " : this. getMinutes(), //minute
"s " : this.getSeconds(), //second
"w " : "天一二三四五六".charAt(this.getDay()), / /week
"q " : Math.floor((this.getMonth() 3) / 3), //quarter
"S" : this.getMilliseconds() //millisecond
}
if(/(y )/.test(style)) {
style = style.replace(RegExp.$1,
(this.getFullYear() "").substr(4 - RegExp.$1.length) );
}
for(var k in o){
if(new RegExp("(" k ")").test(style)){
style = style.replace(RegExp .$1,
RegExp.$1.length == 1 ? o[k] :
("00" o[k]).substr(("" o[k]).length)); <🎜 >} <🎜>} <🎜>return style; <🎜>} <🎜><🎜>//2007-09-14 Added by Han Yufeng Return the selected date <🎜>Calendar.prototype.ReturnDate = function(dt ) { <🎜>if (this.dateControl != null){this.dateControl.value = dt;} <🎜>calendar.hide(); <🎜> if(this.dateControl.onchange == null){return; }
//확인 이벤트가 발생하지 않도록 onchange를 다른 함수로 변환
var ev = this.dateControl.onchange.toString() //함수 문자열 찾기
ev = ev.substring(
((ev.indexOf("ValidatorOnChange();")> 0) ? ev.indexOf("ValidatorOnChange();") 20: ev.indexOf("{") 1)
, ev.lastIndexOf( "}"));//검증 함수 제거 ValidatorOnChange();
var fun = new Function(ev); //함수 재정의
this.dateControl.changeEvent = fun; .changeEvent();//사용자 정의 ChangeEvent 함수
}
/**//**//**//**//**
* Calendar 클래스
* @param BeginYear 1990
* @param endYear 2010
* @param lang 0(중국어) | 1(영어) 자유롭게 확장 가능
* @ param dateFormatStyle "yyyy-MM-dd";
* @version 2006-04-01
* @author KimSoft (jinqinghua [at] gmail.com)
* @update
*//**//**//**
* 달력 클래스
* @param BeginYear 1990
* @param endYear 2010
* @param lang 0(중국어)|1(영어) 자유롭게 확장 가능
* @param dateFormatStyle " yyyy-MM-dd";
* @version 2006-04-01
* @author KimSoft (jinqinghua [at] gmail.com)
* @update
*/
기능 달력 (beginYear, endYear, lang, dateFormatStyle) {
this.beginYear = 1950;
this.endYear = 2050;
this.lang = 0(중국어)
this.dateFormatStyle = "yyyy-MM-dd hh:mm:ss";
if (beginYear != null && endYear != null){
this.beginYear = startYear; .endYear = endYear;
}
if (lang != null){
this.lang = lang
}
if (dateFormatStyle != null){
this .dateFormatStyle = dateFormatStyle
}
this.dateControl = null;
this.panel = this.getElementById("calendarPanel")
this.container = this.getElementById(" ContainerPanel" );
this.form = null;
this.date = new Date()
this.year = this.date.getFullYear(); date.getMonth();
this.day = this.date.getDate();
this.hour = this.date.getHours();
this.min. getMinutes();
this.second = this.date.getSeconds();
this.colors = {
"cur_word" : "#FFFFFF", //오늘 날짜 텍스트 색상
"cur_bg" : "#00FF00", //현재 날짜 셀의 배경색
"sel_bg" : "#FFCCCC", //선택한 날짜 셀의 배경색2006-12-03 한유 메이플 추가됨
"sun_word" : "#FF0000", //일요일 텍스트 색상
"sat_word" : "#0000FF", //토요일 텍스트 색상
"td_word_light" : "#333333", // 셀 텍스트 color
"td_word_dark" : "#CCCCCC", //셀 텍스트 어두운 색
"td_bg_out" : "#EFEFEF", //셀 배경색
"td_bg_over" : "#FFCC00 ", // 셀 배경색
"tr_word" : "#FFFFFF", //캘린더 헤더 텍스트 색상
"tr_bg" : "#666666", //캘린더 헤더 및 배경색
"input_border" : "#CCCCCC ", //입력컨트롤 테두리 색상
"input_bg" : "#EFEFEF" //입력컨트롤 뒷면 색상
}
/* //2008-01-29 넣어주세요 show , pickMode 판단이 필요하기 때문입니다
this.draw();
this.bindYear()
this.bindMonth()
*/
//this.changeSelect ()
//this.bindData(); //2006-12-30 Migong.Zhuanjia
}
/**//**
* 캘린더 클래스 속성(언어 팩, 자유롭게 확장 가능)
** *****
* 캘린더 클래스 속성(언어 팩, 자유롭게 확장 가능)
*/
Calendar.언어 = {
"연도" : [ [""], [""]],
"월" : [["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월","9월","10월","11월","12월"],
["JAN","FEB","MAR"," APR","MAY","JUN"," JUL","AUG","SEP","OCT","NOV","DEC"]
],
"주" : [[" "日","一","two", "삼","사","五","六"],
["SUN","MON","TUR","WED","THU","FRI","SAT"]
],
"시" : [["시"], ["H"]],
"분" : [["분"], ["M"]],
" 초" : [["초"], ["S"]],
"지우기" : [["지우기"], ["CLS"]],
"오늘" : [["오늘" ], ["TODAY"]],
"pickTxt" : [["OK"], ["OK"]],//pickMode는 연도와 월까지 정확합니다. 오늘을 "OK"로 설정하세요.
"close " : [["Close"], ["CLOSE"]]
}
Calendar.prototype.draw = function() {
Calendar = this; var mvAry = [];//mvAry[mvAry.length] = '