このカレンダーを修正するには?戻るボタンを作成してカレンダー フォームの参照を作成するのに本当に混乱しました。月ごとの 'RsT' 番号を変更して、月の開始日と同等にする必要がありますか?
注 :
- RsT: カレンダーの開始位置番号。
- mt: 月数。
- dy: 今日の日
- maxDate: 月末日。
- newMth() 関数: カレンダーを作成します。
- onBtnPress(i) 関数: ボタン応答。
- aD: (最初の日付 - 1)、実際には = 0。
- CnT/CtX: カウント用。
- it[]: 要素 ID。
- mm[]: 月の名前。
<HTML><HEAD>
<TITLE>Kalender Digital</TITLE>
<HTA:APPLICATION
APPLICATIONNAME="Calendar"
VERSION="1.0.2.1"
BORDER="THICK"
INNERBORDER="NO"
MAXIMIZEBUTTON="NO"
SCROLL="NO"
SINGLEINSTANCE="YES"
CONTEXTMENU="NO"
SELECTION="NO"/>
<STYLE TYPE='TEXT/CSS'>
TABLE{width:702px;height:350px;}
TD{font-family:arial;font-weight:bold;width:100px;height:50px;font-size:12pt;}
.header{font-family:arial;font-weight:bold;height:50px;font-size:26pt;color:orange;}
TD.dy{color:blue;}
TD.jm{color:green;}
TD.mg{color:red;}
BUTTON{width:100%;height:100%;cursor:pointer;}
</STYLE><META HTTP-EQUIV='MSThemeCompatible' CONTENT='YES'></HEAD>
<BODY TOPMARGIN='0' LEFTMARGIN='0'>
<TABLE BGCOLOR='#FFFFFF' BORDER='1' BORDERCOLOR='#000000' CELLSPACING='0px' CELLPADDING='0px' TABINDEX='0'>
<TR ALIGN='CENTER'><TD CLASS='header' COLSPAN='4' ID='dtl' STYLE='WIDTH:400px'></TD><TD COLSPAN='1'><BUTTON LANGUAGE='JavaScript' ONCLICK='onBtnPress(1)'><<</BUTTON></TD><TD COLSPAN='1'><BUTTON>Today</BUTTON></TD><TD COLSPAN='1'><BUTTON LANGUAGE='JavaScript' ONCLICK='onBtnPress(0)'>>></BUTTON></TD></TR>
<TR ALIGN='CENTER'><TD CLASS='dy'>Monday</TD><TD CLASS='dy'>Tuesday</TD><TD CLASS='dy'>Wednesday</TD><TD CLASS='dy'>Thursday</TD><TD CLASS='jm'>Friday</TD><TD CLASS='dy'>Saturday</TD><TD CLASS='mg'>Sunday</TD></TR>
<TR ALIGN='CENTER'><TD ID='aa' CLASS='dy'>-</TD><TD ID='ab' CLASS='dy'>-</TD><TD ID='ac' CLASS='dy'>-</TD><TD ID='ad' CLASS='dy'>-</TD><TD ID='ae' CLASS='jm'>-</TD><TD ID='af' CLASS='dy'>-</TD><TD ID='ag' CLASS='mg'>-</TD></TR>
<TR ALIGN='CENTER'><TD ID='ba' CLASS='dy'>-</TD><TD ID='bb' CLASS='dy'>-</TD><TD ID='bc' CLASS='dy'>-</TD><TD ID='bd' CLASS='dy'>-</TD><TD ID='be' CLASS='jm'>-</TD><TD ID='bf' CLASS='dy'>-</TD><TD ID='bg' CLASS='mg'>-</TD></TR>
<TR ALIGN='CENTER'><TD ID='ca' CLASS='dy'>-</TD><TD ID='cb' CLASS='dy'>-</TD><TD ID='cc' CLASS='dy'>-</TD><TD ID='cd' CLASS='dy'>-</TD><TD ID='ce' CLASS='jm'>-</TD><TD ID='cf' CLASS='dy'>-</TD><TD ID='cg' CLASS='mg'>-</TD></TR>
<TR ALIGN='CENTER'><TD ID='da' CLASS='dy'>-</TD><TD ID='db' CLASS='dy'>-</TD><TD ID='dc' CLASS='dy'>-</TD><TD ID='dd' CLASS='dy'>-</TD><TD ID='de' CLASS='jm'>-</TD><TD ID='df' CLASS='dy'>-</TD><TD ID='dg' CLASS='mg'>-</TD></TR>
<TR ALIGN='CENTER'><TD ID='ea' CLASS='dy'>-</TD><TD ID='eb' CLASS='dy'>-</TD><TD ID='ec' CLASS='dy'>-</TD><TD ID='ed' CLASS='dy'>-</TD><TD ID='ee' CLASS='jm'>-</TD><TD ID='ef' CLASS='dy'>-</TD><TD ID='eg' CLASS='mg'>-</TD></TR>
<TR ALIGN='CENTER'><TD ID='fa' CLASS='dy'>-</TD><TD ID='fb' CLASS='dy'>-</TD><TD ID='fc' CLASS='dy'>-</TD><TD ID='fd' CLASS='dy'>-</TD><TD ID='fe' CLASS='jm'>-</TD><TD ID='ff' CLASS='dy'>-</TD><TD ID='fg' CLASS='mg'>-</TD></TR>
</TABLE></BODY>
<SCRIPT LANGUAGE='JavaScript'>
dt = new Date()
it = ["aa", "ab", "ac", "ad", "ae", "af", "ag", "ba", "bb", "bc", "bd", "be", "bf", "bg", "ca", "cb", "cc", "cd", "ce", "cf", "cg", "da", "db", "dc", "dd", "de", "df", "dg", "ea", "eb", "ec", "ed", "ee", "ef", "eg", "fa", "fb", "fc", "fd", "fe", "ff", "fg"];
mm = ["January", "February", "March", "April", "May", "June", "July", "Agust", "September", "October", "November", "December"];
var mt = dt.getMonth();
var yr = dt.getFullYear();
dtl.innerHTML = mm[mt] + " " + yr
var RsT = 2;
var CnT = 0;
var aD = 0;
newMth();
function newMth () {
var d2 = new Date(yr, (mt + 1), aD);
maxDate = d2.getDate()
while (CnT < maxDate) {
aD = (aD + 1);
RsT = (RsT+1)
document.getElementById(it[RsT]).innerHTML = aD;
CnT = (CnT + 1)};
}
function onBtnPress (i) {
CnT = 0;
aD = 0;
CtX = 0;
if (i == 0) {
RsC = 28;
while (document.getElementById(it[RsC]).innerHTML != "-" & RsC <= 41) {
RsC = (RsC+1);
}
if (RsC < 35) {
RsC = (RsC - 28)
} else {
RsC=(RsC-35)
}
RsT = (6 - (7 - RsC));
if (mt <= 10) {
mt = (mt + 1)
} else {
mt=0;yr=(yr+1);
}
} else if (i==1) {
if (mt > 0) {
mt = (mt - 1)
} else {
mt = 11;
yr = (yr - 1);
}
}
while (CtX < 41) {
document.getElementById(it[CtX]).innerHTML = "-";
CtX = (CtX + 1);
}
newMth();
dtl.innerHTML = mm[mt] + " " + yr
}
</SCRIPT>
</HTML>