calendar.js

来自「酒店管理,主要从事酒店管理都可以.这可是北大青鸟的程序」· JavaScript 代码 · 共 43 行

JS
43
字号
function calendar(t) {
	var sPath = "../command/calendar1.htm";
	strFeatures = "dialogWidth=206px;dialogHeight=208px;center=yes;help=no;status=no";
	st = t.value;
	sDate = showModalDialog(sPath,st,strFeatures);
	t.value = formatDate(sDate, 0);
	
}

function checkDate(t) {
	dDate = new Date(t.value);
	if (dDate == "NaN") {t.value = ""; return;}
	iYear = dDate.getFullYear()
	if ((iYear > 1899)&&(iYear < 1950)) {
		sYear = "" + iYear + ""
		if (t.value.indexOf(sYear,1) == -1) {
			iYear += 100
		     sDate = (dDate.getMonth() + 1) + "-" + dDate.getDate() + "-" + iYear
		//	sDate = (dDate.getMonth() + 1) + "," + dDate.getDate() + "," + iYear
			dDate = new Date(sDate)
		}
	}
	t.value = formatDate(dDate);
}

function formatDate(sDate) {
	var sScrap = "";
	var dScrap = new Date(sDate);
	if (dScrap == "NaN") return sScrap;
	
	iDay = dScrap.getDate();
	iMon = dScrap.getMonth();
	iYea = dScrap.getFullYear();

	sScrap = iYea + "-" + d2(iMon + 1) + "-" + d2(iDay) ;
	//sScrap = iYea + "," + d2(iMon + 1) + "," + d2(iDay) ;
	return sScrap;
}

function d2(d) {
	return ((d<10) ? "0"+d : d) ;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?