⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.asp.bak

📁 这是我个人用ASP制作 的一个动态网页,也是我的主页,谢谢大家的使用~~~`
💻 BAK
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
if request.form("last")<>"" then           '当用户点击“下月”
   session("months")=session("months")+1
   nowyears=session("years")
   nowmonths=session("months")
    if session("months")=13 then
       session("months")=1
	   nowmonths=session("months")
      session("years")=session("years")+1
    end if
  times=cdate(session("years")&"-"&session("months")&"-"&session("days"))
end if
if request.form("first")<>"" then         '当用户点击“上月”
   session("months")=session("months")-1
   nowmonths=session("months")
   nowyears=session("years")
   if session("months")=0 then
      session("months")=12
	  nowmonths=session("months")
      session("years")=session("years")-1
   end if
   times=cdate(session("years")&"-"&session("months")&"-"&session("days"))
end if
%>
<%
if request.form("first")="" and request.form("last")="" then
times=date()
session("years")=year(times)
nowyears=session("years")
session("months")=month(times)
nowmonths=session("months")
session("days")=day(times)
end if
session("weekdays")=weekday(times)
if nowmonths=1 or nowmonths=3 or nowmonths=5 or nowmonths=7 or nowmonths=8 or nowmonths=10 or nowmonths=12 then
  days=31
end if
if nowmonths=4 or nowmonths=6 or nowmonths=9 or nowmonths=11 then
  days=30
end if
if nowmonths=2 then
  if nowyears mod 400=0 or nowyears mod 100<>0 and nowyears mod 4=0 then
      days=29
  else
      days=28
  end if
end if
number1=cdate(session("years")&"-"&session("months")&"-"&"01")  '本月1号处理成当前时间
numberweekday=weekday(number1)              '是星期几
weekday1=numberweekday-1                    '用weekday函数计算出来的星期比正常的大1
numberm=cdate(session("years")&"-"&session("months")&"-"&days)   '本月最后一天处理成当前时间
numberweekday=weekday(numberm)             '本月最后一天是星期几
weekdaym=numberweekday-1                  '用weekday函数计算出来的星期比正常的大1
session.timeout=240                       'session生命周期为240分钟
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>万年历</title>
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>
<body background="Image/bd.gif">
<table width="70" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#FFFFFF">
  <tr>
    <td height="15" background="Image/board_left.gif">&nbsp;</td>
    <td colspan="8" background="Image/board_left.gif" align="center"><span class="style1">简 易 万 年 历</span></td>
    <td background="Image/board_right.gif">&nbsp;</td>
  </tr>
  <tr>
    <td width="10" height="15" align="center">周日</td>
    <td width="10" align="center">周一</td>
    <td width="10" align="center">周二</td>
    <td width="10" align="center">周三</td>
    <td width="10" align="center">周四</td>
    <td width="10" align="center">周五</td>
    <td width="10" align="center">周六</td>
    <td width="10" colspan="3" align="center">&nbsp;</td>
  </tr>
  <tr>
    <td colspan="7" valign="top" height="">
	<table height="15" border="0" cellpadding="0" cellspacing="0">
      <tr>
	    <%for i=1 to weekday1    '本月1号在显示之前所有表格为空%>
          <td width="12">&nbsp;</td> 
	    <%next%>
	    <%
		if 7-weekday1<>7 then   '如果万年历第一行没有7天也就是说本月1号不是星期日
		for i=1 to 7-weekday1   '当月1号一直到本行结束其它日期显示位置%>
	      <td width="12" align="center" <%if i=session("days") then   '如果第一行某天恰好为当日则该表格变色%> bgcolor=<%="#ffcc00"%> <%end if%>><font size="6" <%if  i=(7-weekday1) then  '本行最后一个数(周六)字体变成红色%> color="#FF0000" <%end if%>><%=i%></font></td>
        <%next
		else                    '如果1号是星期日
		for i=1 to 7-weekday1 
		%>
		<td width="12" align="center" <%if i=session("days") then     '如果第一行某天恰好为当日则该表格变色%> bgcolor=<%="#ffcc00"%> <%end if%>><font size="6" <%if  i=(7-weekday1) or i=1 then '1号和本行最后一个数(周六)变成红色%> color="#FF0000" <%end if%>><%=i%></font></td>
        <%next
		end if
		%>
	  </tr>
    </table>
	<table height="15" border="0" cellpadding="0" cellspacing="0">
	 <%
	  startday=7-weekday1+1      '第二行开始第一个数
	   num=days-(7-weekday1)-numberweekday     '除了第一行和最后一行的数字,中间一共有多少个数字
	    row=num/7                     '除第一行和最后一行,中间共有多少行
	     for i=1 to row   
	      %>
          <tr>
		   <%
		    for j=1 to 7
		   %>
           <td width="12" align="center" height="15" <%if startday=session("days") then%> bgcolor=<%="#ffcc00"%> <%end if%>><font size="6" <%if j=7 or j=1 then%> color="#FF0000" <%end if%>><%=startday%></font></td>
		   <%
		   startday=startday+1
		   next%>
          </tr>
	  <%next%>
    </table>
	<table height="15" border="0" cellpadding="0" cellspacing="0">
      <tr>
	   <%                             '最后一行
	   if weekdaym<>6 then            '判断本月最后一天是不是星期六
	   for i=weekdaym to 0 step -1    '如果不是星期六%>
         <td width="12" align="center" <%if (days-i)=session("days") then   '如果最后一行某天恰好为当日则该表格变色%> bgcolor=<%="#ffcc00"%> <%end if%>><font size="6" <%if i=weekdaym then   '如果i为最后一行第一位,是星期日字体变红%> color="#FF0000" <%end if%>><%=(days-i)%></font></td>
		<%next
		else                          '如果是星期六
		for i=weekdaym to 0 step -1
		%>
		<td width="12" align="center" <%if (days-i)=session("days") then    '如果最后一行某天恰好为当日则该表格变色%> bgcolor=<%="#ffcc00"%> <%end if%>><font size="6" <%if i=weekdaym or i=0 then  '如果i是最后一天第一位和最后一位,分别是周六和周日,则字体变红%> color="#FF0000" <%end if%>><%=(days-i)%></font></td>
        <%next
		end if
		%>
	  </tr>
    </table></td>
    <td colspan="3" align="center">
	<%=session("years")%>年<%=session("months")%>月
	<form name="form1" method="post" action="">
      <p>
        
        <input name="first" type="submit" id="first" value="上月">
</p>
      <p>
        <input name="last" type="submit" id="last" value="下月">  
        </p>
    </form></td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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