var cal;
var isFocus=false; //フォーカスかどうか
var pickMode ={
"秒":1,
"分":2,
"時":3,
"日":4,
"月":5,
"年":6 };
var topY=0,leftX=0 ; / /カスタム位置オフセット 2007-02-11 Han Yufeng によって追加されました
//日付を選択 → Han Yufeng によって追加されました 2007-06-10、ID によって日付を選択
関数 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)}
}
//日付の選択→ Han Yufeng により追加 2006-06-25
function SelectDate(obj,strFormat,x,y)
{
leftX =( x == null) ? leftX : x;
topY =(y == null) ? topY : y; // カスタム位置オフセット 2007 年 2 月 11 日追加
if(document.getElementById(") ContainerPanel")==null){InitContainerPanel();}
var date = new Date();
var by = date.getFullyear()-50; //最小値→ 50 年前
var ey = date.getFull Year() 50; //最大値→ 50 年後
//cal = new Calendar(by, ey,1,strFormat) //英語版を初期化、0 は中国語版
cal = (cal==null) ? new Calendar(by, ey, 0) : cal; //毎回初期化する必要はありません2006-12-03 Correction
cal.DateMode =pickMode ["second"] / /Reset
if(strFormat.indexOf('s')if(strFormat .indexOf('m' )if(strFormat.indexOf('h')if(strFormat.indexOf('d')< 0) {cal.DateMode =pickMode["month"];}//精度は月です
if (strFormat.indexOf('M')< 0) {cal.DateMode =pickMode["year"];}//精度は年です
if(strFormat.indexOf('y')< 0 ) { cal.DateMode =pickMode["second"];} //デフォルトの精度は秒です。
cal.dateFormatStyleOld = cal.dateFormatStyle;
cal.show(obj); 🎜>}
/**//**//**//**//**
* 日付を返します
* @param d 区切り文字
* @param p 日付のパターン
2006-06-25 Han Yufeng によってユーザーが指定したスタイルに変更されました確認するため
*//**//**//**
* 返却日
* @param d区切り文字
* @param p 日付のパターン
2006-06-25 ユーザーが指定したスタイルに基づいて決定されるように Han Yufeng によって変更されました。 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 );//日
var h = this.substring(style.indexOf('h'),style.lastIndexOf('h') 1);//時間
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
}
/**//**
* 日付の形式
* @param d 区切り文字
* @param p 日付のパターン
* @author meizz
*<🎝>*<🎝>*<🎝>*<🎝>*<🎝>*<🎝>*
* 日付の形式
* @param 区切り文字
* @param p 日付のパターン
* @author meizz
*/
Date.prototype.format = function(style) {
var o = {
"M " : this .getMonth() 1, //月
"d " : this.getDate(), //日
"h " : this.getHours(), //時間
"m " : this. getMinutes(), //分
"s " : this.getSeconds(), //秒
"w " : "天一二三四五六".charAt(this.getDay()), / /週
"q " : Math.floor((this.getMonth() 3) / 3), //四半期
"S" : this.getMilliseconds() //ミリ秒
}
if(/(y )/.test(style)) {
style = style.replace(RegExp.$1,
(this.getFull Year() "").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 Han Yufeng により追加 選択された日付を返します <🎜>Calendar.prototype.ReturnDate = function(dt ) { <🎜>if (this.dateControl != null){this.dateControl.value = dt;} <🎜>calendar.hide() <🎜> if(this.dateControl.onchange == null){return; }
//Convert onchange to other functions to avoid triggering verification events
var ev = this.dateControl.onchange.toString(); //Find the string of the function
ev = ev.substring(
((ev.indexOf("ValidatorOnChange();")> 0) ? ev.indexOf("ValidatorOnChange();") 20: ev.indexOf("{") 1)
, ev.lastIndexOf ("}"));//Remove the validation function ValidatorOnChange();
var fun = new Function(ev); //Redefine the function
this.dateControl.changeEvent = fun;
this.dateControl .changeEvent();//Trigger custom changeEvent function
}
/**//**//**//**//**
* Calendar class
* @param beginYear 1990
* @param endYear 2010
* @param lang 0 (Chinese) | 1 (English) Can be freely expanded
* @ param dateFormatStyle "yyyy-MM-dd";
* @version 2006-04-01
* @author KimSoft (jinqinghua [at] gmail.com)
* @update
*//**//**//**
* Calendar class
* @param beginYear 1990
* @param endYear 2010
* @param lang 0(Chinese)|1(English) Freely expandable
* @param dateFormatStyle "yyyy-MM-dd";
* @version 2006-04-01
* @author KimSoft (jinqinghua [at] gmail.com)
* @update
*/
function Calendar(beginYear, endYear, lang, dateFormatStyle) {
this.beginYear = 1950;
this.endYear = 2050;
this.lang = 0; //0(Chinese) | 1(English)
this.dateFormatStyle = "yyyy-MM-dd hh:mm:ss";
if (beginYear != null && endYear != null){
this.beginYear = beginYear;
this.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();
this.month = this.date.getMonth();
this.day = this.date.getDate();
this.hour = this.date.getHours();
this.minute = this. date.getMinutes();
this.second = this.date.getSeconds();
this.colors = {
"cur_word" : "#FFFFFF", //Today’s date text color
"cur_bg" : "#00FF00", //The background color of the current date cell
"sel_bg" : "#FFCCCC", //The background color of the selected date cell2006-12-03 Han Yu Maple added
"sun_word" : "#FF0000", //Sunday text color
"sat_word" : "#0000FF", //Saturday text color
"td_word_light" : "#333333", // Cell text color
"td_word_dark" : "#CCCCCC", //Cell text dark color
"td_bg_out" : "#EFEFEF", //Cell background color
"td_bg_over" : "#FFCC00 ", //Cell background color
"tr_word" : "#FFFFFF", //Calendar header text color
"tr_bg" : "#666666", //Calendar header and background color
"input_border" : "#CCCCCC", //The border color of the input control
"input_bg" : "#EFEFEF" //The back color of the input control
}
/* //2008-01-29 Put it in show , because the pickMode judgment needs to be made
this.draw();
this.bindYear();
this.bindMonth();
*/
//this.changeSelect();
//this.bindData(); //2006-12-30 Commented by Migong.Zhuanjia
}
/**//**
* Calendar class attributes (language pack, freely expandable)
*******
* Calendar class attributes (language pack, freely extendable)
*/
Calendar.language = {
"year" : [ [""], [""]],
"months" : [["January", "February", "March", "April", "May", "June", "July","August","September","October","November","December"],
["JAN","FEB","MAR"," APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC"]
],
"weeks" : [[" "日","一","二","三","四","五","六"],
["SUN","MON","TUR","WED","THU ","FRI","SAT"]
],
"hour" : [["hour"], ["H"]],
"minute" : [["minute"], ["M"]],
"second" : [["seconds"], ["S"]],
"clear" : [["clear"], ["CLS"]],
"today" : [["Today"], ["TODAY"]],
"pickTxt" : [["OK"], ["OK"]],//pickMode is accurate to the year and month Make today "OK"
"close" : [["Close"], ["CLOSE"]]
} Calendar.prototype.draw = function() { calendar = this; var mvAry = []; //mvAry[mvAry.length] = '