asp 簡單萬年曆顯示

來源:互聯網
上載者:User

 <%'聲明,程式規啊堅所有@
function wr(str)
   response.Write(str)
end function
thedate=date()
function ljj_days()'本月的天數
ljj_days=DateDiff("d",year(thedate)&"-"&month(thedate)&"-1",DateAdd("m",1,CDate(year(thedate)&"-"&month(thedate)&"-1")))
end function

function firstweek(y,m)'一日的周次
 firstweek=Weekday(DateSerial(y,m, 1))
end function

%>
  <%'初始化數組
dim arrays(7,7)
dim tem
tem=1
ds=date()
fir=firstweek(year(ds),month(ds))
for i=0 to 4
 if i=0 then
   for j=fir-1 to 6
      arrays(i,j)=tem
   tem=tem+1
   next
 else
   for j=0 to 6
      arrays(i,j)=tem
   tem=tem+1
 if tem=31 then
   exit for
    end if
   next
 
 end if
 if tem=31 then
 exit for
 end if
next

%>
  <%
dim ljj_date
ljj_date=date()
dim i
wr("<p align=center>"&year(ljj_date)&"年"&month(ljj_date)&"月</p>")
wr("<hr>")'這裡是一條橫線
for i=1 to 7
    wr("<table border='1' align=center>")
 wr("<tr>")
 if i=1 then '這裡先輸出星期,表頭,啊堅工作室
    wr("<td>星期日</td>")
    wr("<td>星期一</td>")
    wr("<td>星期二</td>")
    wr("<td>星期三</td>")
    wr("<td>星期四</td>")
    wr("<td>星期五</td>")
    wr("<td>星期六</td>")
 else
   for j=1 to 7
     if day(ljj_date)=arrays(i-2,j-1) then
   wr("<td width=48 style=color:red>")
   wr(arrays(i-2,j-1))
   wr("</td>")
  else
   wr("<td width=48 >")
   wr(arrays(i-2,j-1))
   wr("</td>")
  end if
   next
  end if
 wr("</tr>")
next
%>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.