日历控件
calendar.htm:
calendar.inc:
调用:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link rel="stylesheet" type="text/css" href="../setstyle.css">
</head>
<body topmargin=0 leftmargin=0 bgcolor=#3974AE >
<center>
<table border="1" width="245" cellspacing="0" cellpadding="0" bordercolor="#ABC7E2" bordercolordark="#FFFFFF" bordercolorlight="#808080" height="160">
<tr>
<th width="100%" align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<th valign="middle" width="10%"><img border="0" src="../images/left.gif" align="absmiddle" onclick="VBScript: showm -1" style="cursor:hand;" alt="Previous" width="23" height="25"></th>
<th width="63%">
<select id=sely onchange="VBScript: changey" style="font-family:Arial">
<option value="1920">1920</option>
<option value="1921">1921</option>
<option value="1922">1922</option>
<option value="1923">1923</option>
<option value="1924">1924</option>
<option value="1925">1925</option>
<option value="1926">1926</option>
<option value="1927">1927</option>
<option value="1928">1928</option>
<option value="1929">1929</option>
<option value="1930">1930</option>
<option value="1931">1931</option>
<option value="1932">1932</option>
<option value="1933">1933</option>
<option value="1934">1934</option>
<option value="1935">1935</option>
<option value="1936">1936</option>
<option value="1937">1937</option>
<option value="1938">1938</option>
<option value="1939">1939</option>
<option value="1940">1940</option>
<option value="1941">1941</option>
<option value="1942">1942</option>
<option value="1943">1943</option>
<option value="1944">1944</option>
<option value="1945">1945</option>
<option value="1946">1946</option>
<option value="1947">1947</option>
<option value="1948">1948</option>
<option value="1949">1949</option>
<option value="1950">1950</option>
<option value="1951">1951</option>
<option value="1952">1952</option>
<option value="1953">1953</option>
<option value="1954">1954</option>
<option value="1955">1955</option>
<option value="1956">1956</option>
<option value="1957">1957</option>
<option value="1958">1958</option>
<option value="1959">1959</option>
<option value="1960">1960</option>
<option value="1961">1961</option>
<option value="1962">1962</option>
<option value="1963">1963</option>
<option value="1964">1964</option>
<option value="1965">1965</option>
<option value="1966">1966</option>
<option value="1967">1967</option>
<option value="1968">1968</option>
<option value="1969">1969</option>
<option value="1970">1970</option>
<option value="1971">1971</option>
<option value="1972">1972</option>
<option value="1973">1973</option>
<option value="1974">1974</option>
<option value="1975">1975</option>
<option value="1976">1976</option>
<option value="1977">1977</option>
<option value="1978">1978</option>
<option value="1979">1979</option>
<option value="1980">1980</option>
<option value="1981">1981</option>
<option value="1982">1982</option>
<option value="1983">1983</option>
<option value="1984">1984</option>
<option value="1985">1985</option>
<option value="1986">1986</option>
<option value="1987">1987</option>
<option value="1988">1988</option>
<option value="1989">1989</option>
<option value="1990">1990</option>
<option value="1991">1991</option>
<option value="1992">1992</option>
<option value="1993">1993</option>
<option value="1994">1994</option>
<option value="1995">1995</option>
<option value="1996">1996</option>
<option value="1997">1997</option>
<option value="1998">1998</option>
<option value="1999">1999</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
<option value="2023">2023</option>
<option value="2024">2024</option>
<option value="2025">2025</option>
<option value="2026">2026</option>
<option value="2027">2027</option>
<option value="2028">2028</option>
<option value="2029">2029</option>
<option value="2030">2030</option>
<option value="2031">2031</option>
<option value="2032">2032</option>
<option value="2033">2033</option>
<option value="2034">2034</option>
<option value="2035">2035</option>
<option value="2036">2036</option>
<option value="2037">2037</option>
<option value="2038">2038</option>
<option value="2039">2039</option>
<option value="2040">2040</option>
<option value="2041">2041</option>
<option value="2042">2042</option>
<option value="2043">2043</option>
<option value="2044">2044</option>
<option value="2045">2045</option>
<option value="2046">2046</option>
<option value="2047">2047</option>
<option value="2048">2048</option>
<option value="2049">2049</option>
<option value="2050">2050</option>
<option value="2051">2051</option>
<option value="2052">2052</option>
<option value="2053">2053</option>
<option value="2054">2054</option>
<option value="2055">2055</option>
<option value="2056">2056</option>
<option value="2057">2057</option>
<option value="2058">2058</option>
<option value="2059">2059</option>
<option value="2060">2060</option>
<option value="2061">2061</option>
<option value="2062">2062</option>
<option value="2063">2063</option>
<option value="2064">2064</option>
<option value="2065">2065</option>
<option value="2066">2066</option>
<option value="2067">2067</option>
<option value="2068">2068</option>
<option value="2069">2069</option>
<option value="2070">2070</option>
<option value="2071">2071</option>
<option value="2072">2072</option>
<option value="2073">2073</option>
<option value="2074">2074</option>
<option value="2075">2075</option>
<option value="2076">2076</option>
<option value="2077">2077</option>
<option value="2078">2078</option>
<option value="2079">2079</option>
<option value="2080">2080</option>
<option value="2081">2081</option>
<option value="2082">2082</option>
<option value="2083">2083</option>
<option value="2084">2084</option>
<option value="2085">2085</option>
<option value="2086">2086</option>
<option value="2087">2087</option>
<option value="2088">2088</option>
<option value="2089">2089</option>
<option value="2090">2090</option>
<option value="2091">2091</option>
<option value="2092">2092</option>
<option value="2093">2093</option>
<option value="2094">2094</option>
<option value="2095">2095</option>
<option value="2096">2096</option>
<option value="2097">2097</option>
<option value="2098">2098</option>
<option value="2099">2099</option>
</select>
<select id=selm onchange="VBScript: changem" style="font-family:细明体;font-size:9pt;">
<option value="1">一月</option>
<option value="2">二月</option>
<option value="3">三月</option>
<option value="4">四月</option>
<option value="5">五月</option>
<option value="6">六月</option>
<option value="7">七月</option>
<option value="8">八月</option>
<option value="9">九月</option>
<option value="10">十月</option>
<option value="11">十一月</option>
<option value="12">十二月</option>
</select></th>
<th valign="middle" width="10%"> <img border="0" src="../images/right.gif" style="cursor:hand;" onclick="VBScript: showm +1" align="absmiddle" alt="Next" width="24" height="25">
</th>
</tr>
</table>
<table border=0 cellspacing=1 bgcolor=#336699 style="color:#FFFFEE;font-size:8pt" cellpadding="0" width="200">
<tr style="color:#FFFFEE;font-family:细明体;font-size:8pt"><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th>六</th></tr>
<tr bgcolor=white><td id=d00 align=center bgcolor="#FFF0D0"></td><td id=d01 align=center></td><td id=d02 align=center></td><td id=d03 align=center></td><td id=d04 align=center></td><td id=d05 align=center></td><td id=d06 align=center></td></tr>
<tr bgcolor=white><td id=d10 align=center bgcolor="#FFF0D0"></td><td id=d11 align=center></td><td id=d12 align=center></td><td id=d13 align=center></td><td id=d14 align=center></td><td id=d15 align=center></td><td id=d16 align=center></td></tr>
<tr bgcolor=white><td id=d20 align=center bgcolor="#FFF0D0"></td><td id=d21 align=center></td><td id=d22 align=center></td><td id=d23 align=center></td><td id=d24 align=center></td><td id=d25 align=center></td><td id=d26 align=center></td></tr>
<tr bgcolor=white><td id=d30 align=center bgcolor="#FFF0D0"></td><td id=d31 align=center></td><td id=d32 align=center></td><td id=d33 align=center></td><td id=d34 align=center></td><td id=d35 align=center></td><td id=d36 align=center></td></tr>
<tr bgcolor=white><td id=d40 align=center bgcolor="#FFF0D0"></td><td id=d41 align=center></td><td id=d42 align=center></td><td id=d43 align=center></td><td id=d44 align=center></td><td id=d45 align=center></td><td id=d46 align=center></td></tr>
<tr bgcolor=white><td id=d50 align=center bgcolor="#FFF0D0"></td><td id=d51 align=center></td><td id=d52 align=center></td><td id=d53 align=center></td><td id=d54 align=center></td><td id=d55 align=center></td><td id=d56 align=center></td></tr>
</table>
<input type=hidden id=hshowmonth value=""><input type=hidden id=hselday value="">
<img border="0" src="../images/today.gif" style="cursor:hand;" onclick="VBScript: seltoday" align="absmiddle" alt="今天" width="59" height="21">
</th>
</tr>
</table>
</center></body>
</html>
<script language=VBScript>
sub window_onload()
seldate=date()
thismonth=cdate(year(date()) & "-" & month(date()) & "-1")
showcal thismonth, seldate
end sub
sub seltoday()
showcal cdate(year(date()) & "-" & month(date()) & "-1"), date()
window.external.raiseEvent date(),window.document
end sub
sub showm(sm)
showcal dateadd("m",sm,document.all.hshowmonth.value),document.all.hselday.value
end sub
sub changey()
selymd=document.all.sely.options(document.all.sely.selectedIndex).value & "-" & month(document.all.hshowmonth.value) & "-1"
showcal selymd,document.all.hselday.value
end sub
sub changem()
selymd=year(document.all.hshowmonth.value) & "-" & document.all.selm.options(document.all.selm.selectedIndex).value & "-1"
showcal selymd,document.all.hselday.value
end sub
sub document_onclick()
if window.event.srcElement.tagName="TD" or window.event.srcElement.tagName="FONT" then
if window.event.srcElement.tagName="TD" then
clickd1=cint(window.event.srcElement.children(0).innerText)
clickd2=cint(mid(window.event.srcElement.id,2,1))
elseif window.event.srcElement.tagName="FONT" then
clickd1=cint(window.event.srcElement.innerText)
clickd2=cint(mid(window.event.srcElement.parentElement.id,2,1))
end if
if clickd1>20 and clickd2=0 then
csm=dateadd("m", -1, cdate(document.all.hshowmonth.value))
elseif clickd1<15 and clickd2>3 then
csm=dateadd("m", +1, cdate(document.all.hshowmonth.value))
else
csm=document.all.hshowmonth.value
end if
csd=year(csm) & "-" & month(csm) & "-" & clickd1
showcal csm, csd
window.external.raiseEvent csd,window.document
end if
end sub
sub showcal(tm, sd)
document.all.hshowmonth.value=tm
document.all.hselday.value=sd
y=year(tm)
m=month(tm)
document.all.sely.selectedIndex=y-1920
document.all.selm.selectedIndex=m-1
k=1-weekday(tm)
chkd=""
for i=0 to 5
for j=0 to 6
k=k+1
if k<1 then
if year(dateadd("m",-1,tm))=year(sd) and month(dateadd("m",-1,tm))=month(sd) and day(dateadd("d",k-1,tm))=day(sd) then
document.all("d" & i & j).innerHTML="<font color=BLUE style='font-weight:Bold' face=Arial>" & day(dateadd("d",k-1,tm)) & "</font>"
else
document.all("d" & i & j).innerHTML="<font color=#B2B2B2 face=Arial>" & day(dateadd("d",k-1,tm)) & "</font>"
end if
elseif k>day(dateadd("d",-1,dateadd("m",1,tm))) then
k=1
chkd="Y"
document.all("d" & i & j).innerHTML="<font color=#B2B2B2 face=Arial>" & k & "</font>"
else
if chkd="Y" then
if year(dateadd("m",+1,tm))=year(sd) and month(dateadd("m",+1,tm))=month(sd) and k=day(sd) then
document.all("d" & i & j).innerHTML="<font color=BLUE style='font-weight:Bold' face=Arial>" & k & "</font>"
else
document.all("d" & i & j).innerHTML="<font color=#B2B2B2 face=Arial>" & k & "</font>"
end if
else
if year(tm)=year(sd) and month(tm)=month(sd) and k=day(sd) then
document.all("d" & i & j).innerHTML="<font color=BLUE style='font-weight:Bold' face=Arial>" & k & "</font>"
else
document.all("d" & i & j).innerHTML="<font color=BLACK face=Arial>" & k & "</font>"
end if
end if
end if
next
next
end sub
</script>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<link rel="stylesheet" type="text/css" href="../setstyle.css">
</head>
<body topmargin=0 leftmargin=0 bgcolor=#3974AE >
<center>
<table border="1" width="245" cellspacing="0" cellpadding="0" bordercolor="#ABC7E2" bordercolordark="#FFFFFF" bordercolorlight="#808080" height="160">
<tr>
<th width="100%" align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<th valign="middle" width="10%"><img border="0" src="../images/left.gif" align="absmiddle" onclick="VBScript: showm -1" style="cursor:hand;" alt="Previous" width="23" height="25"></th>
<th width="63%">
<select id=sely onchange="VBScript: changey" style="font-family:Arial">
<option value="1920">1920</option>
<option value="1921">1921</option>
<option value="1922">1922</option>
<option value="1923">1923</option>
<option value="1924">1924</option>
<option value="1925">1925</option>
<option value="1926">1926</option>
<option value="1927">1927</option>
<option value="1928">1928</option>
<option value="1929">1929</option>
<option value="1930">1930</option>
<option value="1931">1931</option>
<option value="1932">1932</option>
<option value="1933">1933</option>
<option value="1934">1934</option>
<option value="1935">1935</option>
<option value="1936">1936</option>
<option value="1937">1937</option>
<option value="1938">1938</option>
<option value="1939">1939</option>
<option value="1940">1940</option>
<option value="1941">1941</option>
<option value="1942">1942</option>
<option value="1943">1943</option>
<option value="1944">1944</option>
<option value="1945">1945</option>
<option value="1946">1946</option>
<option value="1947">1947</option>
<option value="1948">1948</option>
<option value="1949">1949</option>
<option value="1950">1950</option>
<option value="1951">1951</option>
<option value="1952">1952</option>
<option value="1953">1953</option>
<option value="1954">1954</option>
<option value="1955">1955</option>
<option value="1956">1956</option>
<option value="1957">1957</option>
<option value="1958">1958</option>
<option value="1959">1959</option>
<option value="1960">1960</option>
<option value="1961">1961</option>
<option value="1962">1962</option>
<option value="1963">1963</option>
<option value="1964">1964</option>
<option value="1965">1965</option>
<option value="1966">1966</option>
<option value="1967">1967</option>
<option value="1968">1968</option>
<option value="1969">1969</option>
<option value="1970">1970</option>
<option value="1971">1971</option>
<option value="1972">1972</option>
<option value="1973">1973</option>
<option value="1974">1974</option>
<option value="1975">1975</option>
<option value="1976">1976</option>
<option value="1977">1977</option>
<option value="1978">1978</option>
<option value="1979">1979</option>
<option value="1980">1980</option>
<option value="1981">1981</option>
<option value="1982">1982</option>
<option value="1983">1983</option>
<option value="1984">1984</option>
<option value="1985">1985</option>
<option value="1986">1986</option>
<option value="1987">1987</option>
<option value="1988">1988</option>
<option value="1989">1989</option>
<option value="1990">1990</option>
<option value="1991">1991</option>
<option value="1992">1992</option>
<option value="1993">1993</option>
<option value="1994">1994</option>
<option value="1995">1995</option>
<option value="1996">1996</option>
<option value="1997">1997</option>
<option value="1998">1998</option>
<option value="1999">1999</option>
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
<option value="2003">2003</option>
<option value="2004">2004</option>
<option value="2005">2005</option>
<option value="2006">2006</option>
<option value="2007">2007</option>
<option value="2008">2008</option>
<option value="2009">2009</option>
<option value="2010">2010</option>
<option value="2011">2011</option>
<option value="2012">2012</option>
<option value="2013">2013</option>
<option value="2014">2014</option>
<option value="2015">2015</option>
<option value="2016">2016</option>
<option value="2017">2017</option>
<option value="2018">2018</option>
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
<option value="2023">2023</option>
<option value="2024">2024</option>
<option value="2025">2025</option>
<option value="2026">2026</option>
<option value="2027">2027</option>
<option value="2028">2028</option>
<option value="2029">2029</option>
<option value="2030">2030</option>
<option value="2031">2031</option>
<option value="2032">2032</option>
<option value="2033">2033</option>
<option value="2034">2034</option>
<option value="2035">2035</option>
<option value="2036">2036</option>
<option value="2037">2037</option>
<option value="2038">2038</option>
<option value="2039">2039</option>
<option value="2040">2040</option>
<option value="2041">2041</option>
<option value="2042">2042</option>
<option value="2043">2043</option>
<option value="2044">2044</option>
<option value="2045">2045</option>
<option value="2046">2046</option>
<option value="2047">2047</option>
<option value="2048">2048</option>
<option value="2049">2049</option>
<option value="2050">2050</option>
<option value="2051">2051</option>
<option value="2052">2052</option>
<option value="2053">2053</option>
<option value="2054">2054</option>
<option value="2055">2055</option>
<option value="2056">2056</option>
<option value="2057">2057</option>
<option value="2058">2058</option>
<option value="2059">2059</option>
<option value="2060">2060</option>
<option value="2061">2061</option>
<option value="2062">2062</option>
<option value="2063">2063</option>
<option value="2064">2064</option>
<option value="2065">2065</option>
<option value="2066">2066</option>
<option value="2067">2067</option>
<option value="2068">2068</option>
<option value="2069">2069</option>
<option value="2070">2070</option>
<option value="2071">2071</option>
<option value="2072">2072</option>
<option value="2073">2073</option>
<option value="2074">2074</option>
<option value="2075">2075</option>
<option value="2076">2076</option>
<option value="2077">2077</option>
<option value="2078">2078</option>
<option value="2079">2079</option>
<option value="2080">2080</option>
<option value="2081">2081</option>
<option value="2082">2082</option>
<option value="2083">2083</option>
<option value="2084">2084</option>
<option value="2085">2085</option>
<option value="2086">2086</option>
<option value="2087">2087</option>
<option value="2088">2088</option>
<option value="2089">2089</option>
<option value="2090">2090</option>
<option value="2091">2091</option>
<option value="2092">2092</option>
<option value="2093">2093</option>
<option value="2094">2094</option>
<option value="2095">2095</option>
<option value="2096">2096</option>
<option value="2097">2097</option>
<option value="2098">2098</option>
<option value="2099">2099</option>
</select>
<select id=selm onchange="VBScript: changem" style="font-family:细明体;font-size:9pt;">
<option value="1">一月</option>
<option value="2">二月</option>
<option value="3">三月</option>
<option value="4">四月</option>
<option value="5">五月</option>
<option value="6">六月</option>
<option value="7">七月</option>
<option value="8">八月</option>
<option value="9">九月</option>
<option value="10">十月</option>
<option value="11">十一月</option>
<option value="12">十二月</option>
</select></th>
<th valign="middle" width="10%"> <img border="0" src="../images/right.gif" style="cursor:hand;" onclick="VBScript: showm +1" align="absmiddle" alt="Next" width="24" height="25">
</th>
</tr>
</table>
<table border=0 cellspacing=1 bgcolor=#336699 style="color:#FFFFEE;font-size:8pt" cellpadding="0" width="200">
<tr style="color:#FFFFEE;font-family:细明体;font-size:8pt"><th>日</th><th>一</th><th>二</th><th>三</th><th>四</th><th>五</th><th>六</th></tr>
<tr bgcolor=white><td id=d00 align=center bgcolor="#FFF0D0"></td><td id=d01 align=center></td><td id=d02 align=center></td><td id=d03 align=center></td><td id=d04 align=center></td><td id=d05 align=center></td><td id=d06 align=center></td></tr>
<tr bgcolor=white><td id=d10 align=center bgcolor="#FFF0D0"></td><td id=d11 align=center></td><td id=d12 align=center></td><td id=d13 align=center></td><td id=d14 align=center></td><td id=d15 align=center></td><td id=d16 align=center></td></tr>
<tr bgcolor=white><td id=d20 align=center bgcolor="#FFF0D0"></td><td id=d21 align=center></td><td id=d22 align=center></td><td id=d23 align=center></td><td id=d24 align=center></td><td id=d25 align=center></td><td id=d26 align=center></td></tr>
<tr bgcolor=white><td id=d30 align=center bgcolor="#FFF0D0"></td><td id=d31 align=center></td><td id=d32 align=center></td><td id=d33 align=center></td><td id=d34 align=center></td><td id=d35 align=center></td><td id=d36 align=center></td></tr>
<tr bgcolor=white><td id=d40 align=center bgcolor="#FFF0D0"></td><td id=d41 align=center></td><td id=d42 align=center></td><td id=d43 align=center></td><td id=d44 align=center></td><td id=d45 align=center></td><td id=d46 align=center></td></tr>
<tr bgcolor=white><td id=d50 align=center bgcolor="#FFF0D0"></td><td id=d51 align=center></td><td id=d52 align=center></td><td id=d53 align=center></td><td id=d54 align=center></td><td id=d55 align=center></td><td id=d56 align=center></td></tr>
</table>
<input type=hidden id=hshowmonth value=""><input type=hidden id=hselday value="">
<img border="0" src="../images/today.gif" style="cursor:hand;" onclick="VBScript: seltoday" align="absmiddle" alt="今天" width="59" height="21">
</th>
</tr>
</table>
</center></body>
</html>
<script language=VBScript>
sub window_onload()
seldate=date()
thismonth=cdate(year(date()) & "-" & month(date()) & "-1")
showcal thismonth, seldate
end sub
sub seltoday()
showcal cdate(year(date()) & "-" & month(date()) & "-1"), date()
window.external.raiseEvent date(),window.document
end sub
sub showm(sm)
showcal dateadd("m",sm,document.all.hshowmonth.value),document.all.hselday.value
end sub
sub changey()
selymd=document.all.sely.options(document.all.sely.selectedIndex).value & "-" & month(document.all.hshowmonth.value) & "-1"
showcal selymd,document.all.hselday.value
end sub
sub changem()
selymd=year(document.all.hshowmonth.value) & "-" & document.all.selm.options(document.all.selm.selectedIndex).value & "-1"
showcal selymd,document.all.hselday.value
end sub
sub document_onclick()
if window.event.srcElement.tagName="TD" or window.event.srcElement.tagName="FONT" then
if window.event.srcElement.tagName="TD" then
clickd1=cint(window.event.srcElement.children(0).innerText)
clickd2=cint(mid(window.event.srcElement.id,2,1))
elseif window.event.srcElement.tagName="FONT" then
clickd1=cint(window.event.srcElement.innerText)
clickd2=cint(mid(window.event.srcElement.parentElement.id,2,1))
end if
if clickd1>20 and clickd2=0 then
csm=dateadd("m", -1, cdate(document.all.hshowmonth.value))
elseif clickd1<15 and clickd2>3 then
csm=dateadd("m", +1, cdate(document.all.hshowmonth.value))
else
csm=document.all.hshowmonth.value
end if
csd=year(csm) & "-" & month(csm) & "-" & clickd1
showcal csm, csd
window.external.raiseEvent csd,window.document
end if
end sub
sub showcal(tm, sd)
document.all.hshowmonth.value=tm
document.all.hselday.value=sd
y=year(tm)
m=month(tm)
document.all.sely.selectedIndex=y-1920
document.all.selm.selectedIndex=m-1
k=1-weekday(tm)
chkd=""
for i=0 to 5
for j=0 to 6
k=k+1
if k<1 then
if year(dateadd("m",-1,tm))=year(sd) and month(dateadd("m",-1,tm))=month(sd) and day(dateadd("d",k-1,tm))=day(sd) then
document.all("d" & i & j).innerHTML="<font color=BLUE style='font-weight:Bold' face=Arial>" & day(dateadd("d",k-1,tm)) & "</font>"
else
document.all("d" & i & j).innerHTML="<font color=#B2B2B2 face=Arial>" & day(dateadd("d",k-1,tm)) & "</font>"
end if
elseif k>day(dateadd("d",-1,dateadd("m",1,tm))) then
k=1
chkd="Y"
document.all("d" & i & j).innerHTML="<font color=#B2B2B2 face=Arial>" & k & "</font>"
else
if chkd="Y" then
if year(dateadd("m",+1,tm))=year(sd) and month(dateadd("m",+1,tm))=month(sd) and k=day(sd) then
document.all("d" & i & j).innerHTML="<font color=BLUE style='font-weight:Bold' face=Arial>" & k & "</font>"
else
document.all("d" & i & j).innerHTML="<font color=#B2B2B2 face=Arial>" & k & "</font>"
end if
else
if year(tm)=year(sd) and month(tm)=month(sd) and k=day(sd) then
document.all("d" & i & j).innerHTML="<font color=BLUE style='font-weight:Bold' face=Arial>" & k & "</font>"
else
document.all("d" & i & j).innerHTML="<font color=BLACK face=Arial>" & k & "</font>"
end if
end if
end if
next
next
end sub
</script>
calendar.inc:
<OBJECT id=calendar style="LEFT: 310px; VISIBILITY: hidden; TOP: 237px; POSITION: ABSOLUTE;" type=text/x-scriptlet
height=160 width=245 data=../script/calendar.htm></OBJECT>
<script language="vbscript">
dim CanTarget
sub btdate(n)
If document.all.calendar.style.visibility="" Then
document.all.calendar.style.visibility="hidden"
Else
DivTop = document.body.scrolltop + window.event.Y + 30
document.all.calendar.style.top = Divtop
document.all.calendar.style.visibility=""
End If
CanTarget=n
end sub
sub calendar_onscriptletevent(n,o)
document.all.calendar.style.visibility="hidden"
document.all(CanTarget).value=n
end sub
</script>
height=160 width=245 data=../script/calendar.htm></OBJECT>
<script language="vbscript">
dim CanTarget
sub btdate(n)
If document.all.calendar.style.visibility="" Then
document.all.calendar.style.visibility="hidden"
Else
DivTop = document.body.scrolltop + window.event.Y + 30
document.all.calendar.style.top = Divtop
document.all.calendar.style.visibility=""
End If
CanTarget=n
end sub
sub calendar_onscriptletevent(n,o)
document.all.calendar.style.visibility="hidden"
document.all(CanTarget).value=n
end sub
</script>
调用:
<INPUT id="tbBeginTime" runat="server" Width="89px" style="WIDTH: 80px; CURSOR: hand; HEIGHT: 22px" onclick="VBScript: btdate 'tbBeginTime'" size="8">
<INPUT id="tbEndTime" runat="server" Width="79px" style="WIDTH: 80px; CURSOR: hand; HEIGHT: 22px" onclick="VBScript: btdate 'tbEndTime'" size="8">
<!--script--> <!--#Include file="script/calendar.inc" -->
<SCRIPT language="VBScript">
Sub QueryTransfer(xlink)
QueryForm.encoding="application/x-www-form-urlencoded"
QueryForm.action = xlink
QueryForm.Submit
End Sub
</SCRIPT>
<INPUT id="tbEndTime" runat="server" Width="79px" style="WIDTH: 80px; CURSOR: hand; HEIGHT: 22px" onclick="VBScript: btdate 'tbEndTime'" size="8">
<!--script--> <!--#Include file="script/calendar.inc" -->
<SCRIPT language="VBScript">
Sub QueryTransfer(xlink)
QueryForm.encoding="application/x-www-form-urlencoded"
QueryForm.action = xlink
QueryForm.Submit
End Sub
</SCRIPT>