📄 calendar.htm
字号:
else if (RE_NUM.exec(arr_time[1]))
if (arr_time[1] < 60) dt_date.setMinutes(arr_time[1]);
else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed range is 00-59.");
else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed values are unsigned integers.");
if (!arr_time[2]) dt_date.setSeconds(0);
else if (RE_NUM.exec(arr_time[2]))
if (arr_time[2] < 60) dt_date.setSeconds(arr_time[2]);
else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed range is 00-59.");
else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed values are unsigned integers.");
dt_date.setMilliseconds(0);
return dt_date;
}
function cal_error (str_message) {
// alert (str_message);
return null;
}
// function passing selected date to calling window
function set_datetime(n_datetime, b_close) {
var dt_datetime = prs_time(
(document.cal ? document.cal.txtHour.value + ':' + document.cal.txtMinute.value + ':' + document.cal.txtSecond.value : ''),
new Date(n_datetime)
);
if (!dt_datetime) return;
if (b_close) {
window.returnValue = (document.cal ? gen_tsmp(dt_datetime) : gen_date(dt_datetime));
window.close();
}
else
dt_current = dt_datetime;
init();
print_yearmonth();
print_calendar();
}
var oldHour = 0;
var oldMinute = 0;
var oldSecond = 0;
function set_time() {
oldHour = dt_current.getHours();
oldMinute = dt_current.getMinutes();
oldSecond = dt_current.getSeconds();
document.cal.txtHour.value = oldHour;
document.cal.txtMinute.value = oldMinute;
document.cal.txtSecond.value = oldSecond;
}
function txtHour_onkeydown() {
if (event.ctrlKey) {
event.returnValue = false;
return false;
}
if (event.keyCode == 8 || event.keyCode == 9) {
} else if (event.keyCode == 10 || event.keyCode == 13) {
} else if (event.keyCode >= 33 && event.keyCode <= 40) {
} else if (event.keyCode == 45 || event.keyCode == 46) {
} else if (event.keyCode == 144) {
} else if (event.keyCode < 96 || event.keyCode > 105 ) {
event.returnValue = false;
return false;
}
return true;
}
function txtHour_onkeyup() {
hour = parseInt(document.cal.txtHour.value);
if (hour > 23) {
document.cal.txtHour.value = oldHour;
event.returnValue = false;
return false;
}
oldHour = document.cal.txtHour.value;
return true;
}
function txtMinute_onkeydown() {
if (event.ctrlKey) {
event.returnValue = false;
return false;
}
if (event.keyCode == 8 || event.keyCode == 9) {
} else if (event.keyCode == 10 || event.keyCode == 13) {
} else if (event.keyCode >= 33 && event.keyCode <= 40) {
} else if (event.keyCode == 45 || event.keyCode == 46) {
} else if (event.keyCode == 144) {
} else if (event.keyCode < 96 || event.keyCode > 105 ) {
event.returnValue = false;
return false;
}
return true;
}
function txtMinute_onkeyup() {
hour = parseInt(document.cal.txtMinute.value);
if (hour > 59) {
document.cal.txtMinute.value = oldMinute;
event.returnValue = false;
return false;
}
oldMinute = document.cal.txtMinute.value;
return true;
}
function txtSecond_onkeydown() {
if (event.ctrlKey) {
event.returnValue = false;
return false;
}
if (event.keyCode == 8 || event.keyCode == 9) {
} else if (event.keyCode == 10 || event.keyCode == 13) {
} else if (event.keyCode >= 33 && event.keyCode <= 40) {
} else if (event.keyCode == 45 || event.keyCode == 46) {
} else if (event.keyCode == 144) {
} else if (event.keyCode < 96 || event.keyCode > 105 ) {
event.returnValue = false;
return false;
}
return true;
}
function txtSecond_onkeyup() {
hour = parseInt(document.cal.txtSecond.value);
if (hour > 59) {
document.cal.txtSecond.value = oldSecond;
event.returnValue = false;
return false;
}
oldSecond = document.cal.txtSecond.value;
return true;
}
function btnHourDown_onclick() {
oldHour --;
if (oldHour == -1) oldHour = 23;
document.cal.txtHour.value = oldHour;
}
function btnHourUp_onclick() {
oldHour ++;
if (oldHour == 24) oldHour = 0;
document.cal.txtHour.value = oldHour;
}
function btnMinuteDown_onclick() {
oldMinute --;
if (oldMinute == -1) oldMinute = 59;
document.cal.txtMinute.value = oldMinute;
}
function btnMinuteUp_onclick() {
oldMinute ++;
if (oldMinute == 60) oldMinute = 0;
document.cal.txtMinute.value = oldMinute;
}
function btnSecondDown_onclick() {
oldSecond --;
if (oldSecond == -1) oldSecond = 59;
document.cal.txtSecond.value = oldSecond;
}
function btnSecondUp_onclick() {
oldSecond ++;
if (oldSecond == 60) oldSecond = 0;
document.cal.txtSecond.value = oldSecond;
}
</SCRIPT>
<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY bgColor=#ffffff leftMargin=5 topMargin=5 rightMargin=5 marginwidth="5"
marginheight="5">
<TABLE class=clsOTable cellSpacing=0 width="100%" border=0>
<TBODY>
<TR>
<TD bgColor=#4682b4>
<TABLE cellSpacing=1 cellPadding=1 width="100%" border=0>
<TBODY>
<TR>
<TD colSpan=7>
<DIV id=yearmonth></DIV></TD></TR>
<TR>
<TD colSpan=7>
<DIV id=calendar></DIV></TD></TR>
<SCRIPT language=JavaScript>
// print time
if (TIME_COMP) {
document.write('<form onsubmit="javascript:set_datetime(' + dt_current.valueOf() + ', true)" name="cal"><tr><td colspan="7" bgcolor="#87CEFA">');
document.write(' <table border="0" cellspacing="2" cellpadding="0">');
document.write(' <tr>');
document.write(' <td width="90" rowspan="2" valign="middle" align="right" nowarp>时间:<input id=txtHour name=txtHour style="WIDTH: 25px; TEXT-ALIGN: right" maxLength=2 LANGUAGE=javascript onkeydown="return txtHour_onkeydown()" onkeyup="return txtHour_onkeyup()"></td>');
document.write(' <td width="20"><input id=btnHourUp type=button value=∧ name=btnHourUp style="FONT-WEIGHT: bold; FONT-SIZE: 5pt; WIDTH: 15px; HEIGHT: 10px" tabIndex=-1 LANGUAGE=javascript onclick="return btnHourUp_onclick()"></td>');
document.write(' <td width="25" rowspan="2"><input id=txtMinute name=txtMinute style="WIDTH: 25px; TEXT-ALIGN: right" maxLength=2 LANGUAGE=javascript onkeydown="return txtMinute_onkeydown()" onkeyup="return txtMinute_onkeyup()"></td>');
document.write(' <td width="20"><input id=btnMinuteUp type=button value=∧ name=btnMinuteUp style="FONT-WEIGHT: bold; FONT-SIZE: 5pt; WIDTH: 15px; HEIGHT: 10px" tabIndex=-1 LANGUAGE=javascript onclick="return btnMinuteUp_onclick()"></td>');
document.write(' <td width="25" rowspan="2"><input id=txtSecond name=txtSecond style="WIDTH: 25px; TEXT-ALIGN: right" maxLength=2 LANGUAGE=javascript onkeydown="return txtSecond_onkeydown()" onkeyup="return txtSecond_onkeyup()"></td>');
document.write(' <td width="20"><input id=btnSecondUp type=button value=∧ name=btnSecondUp style="FONT-WEIGHT: bold; FONT-SIZE: 5pt; WIDTH: 15px; HEIGHT: 10px" tabIndex=-1 LANGUAGE=javascript onclick="return btnSecondUp_onclick()"></td>');
document.write(' </tr>');
document.write(' <tr>');
document.write(' <td width="20"><input id=btnHourDown type=button value=∨ name=btnHourDown style="FONT-WEIGHT: bold; FONT-SIZE: 5pt; WIDTH: 15px; HEIGHT: 10px" tabIndex=-1 LANGUAGE=javascript onclick="return btnHourDown_onclick()"></td>');
document.write(' <td width="20"><input id=btnMinuteDown type=button value=∨ name=btnMinuteDown style="FONT-WEIGHT: bold; FONT-SIZE: 5pt; WIDTH: 15px; HEIGHT: 10px" tabIndex=-1 LANGUAGE=javascript onclick="return btnMinuteDown_onclick()"></td>');
document.write(' <td width="20"><input id=btnSecondDown type=button value=∨ name=btnSecondDown style="FONT-WEIGHT: bold; FONT-SIZE: 5pt; WIDTH: 15px; HEIGHT: 10px" tabIndex=-1 LANGUAGE=javascript onclick="return btnSecondDown_onclick()"></td>');
document.write(' </tr>');
document.write(' </table>');
document.write('</td></tr></form>');
set_time();
}
</SCRIPT>
</TBODY></TABLE></TD></TD></TR></TBODY></TABLE>
<SCRIPT language=JavaScript>
print_yearmonth();
</SCRIPT>
<SCRIPT language=JavaScript>
print_calendar();
</SCRIPT>
</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -