asp制作的日歷程序_ASP教程
推薦:ASP Request對象的使用ASP主要有五個內(nèi)建(built-in)對象:Server、Request、Response、Application和Session�,F(xiàn)在我們通過舉例來對它們進(jìn)行講解。首先是最常使用的Response對象。 例1 利用Response在網(wǎng)頁中輸出HTML文檔 您可以在FrontPage Editor,或是寫字板、記事本等書寫器中輸入以上的代
純ASP打造的日歷程序,可自行美化,這里僅提供最簡單的CSS樣式。。。
<style>
body{font-size:12px; margin:20px 0 0 20px; padding:0}
tr,td{text-align:center;}
</style>
<%
'=================================
'說明:日歷文件
'=================================
'取出對應(yīng)的年月博客日志數(shù)據(jù)
'=======================
Ryear = CInt(request.querystring("year"))
Rmonth = CInt(request.querystring("month"))
If Ryear = 0 Or Ryear = NULL Then Ryear = year(now)
If Rmonth = 0 Or Rmonth = NULL Then Rmonth = month(now)
nowtime = Ryear&"-"&Rmonth&"-1" '得到本月第一天
nowyear = year(nowtime) '年份
nowmonth = month(nowtime) '月份
nowweekday = weekday(nowtime) - 1 '當(dāng)前禮拜
'獲取2月天數(shù)
febdays = 28
If nowyear / 4 = 0 Then febdays = 29
'獲取本月天數(shù)
If nowmonth = 1 then
monthdays = 31
ElseIf nowmonth = 2 Then
monthdays = febdays
ElseIf nowmonth = 3 Then
monthdays = 31
ElseIf nowmonth = 4 Then
monthdays = 30
ElseIf nowmonth = 5 Then
monthdays = 31
ElseIf nowmonth = 6 Then
monthdays = 30
ElseIf nowmonth = 7 Then
monthdays = 31
ElseIf nowmonth = 8 Then
monthdays = 31
ElseIf nowmonth = 9 Then
monthdays = 30
ElseIf nowmonth = 10 Then
monthdays = 31
ElseIf nowmonth = 11 Then
monthdays = 30
Else
monthdays = 31
End If
calendar = "<a href='calendar.asp?year="&nowyear - 1&"&month="&nowmonth&"'> <<</a> "
willshowmonthmonth = nowmonth
If willshowmonthmonth - 1 <= 0 Then willshowmonthmonth = 2
calendar = calendar & "<a href='calendar.asp?year="&nowyear&"&month="&willshowmonthmonth - 1&"'> <</a> "
If willshowmonthmonth + 1 > 12 Then willshowmonthmonth = 11
calendar = calendar & "<a href='calendar.asp?year="&nowyear&"&month="&willshowmonthmonth + 1&"''> ></a> "
calendar = calendar & "<a href='calendar.asp?year="&nowyear + 1&"&month="&nowmonth&"'> >></a> "
calendar = calendar & "<table bgcolor=#000000 cellspacing=1 width=200><tr bgcolor=#ffffff><td colspan=7>"&nowyear&"-"&nowmonth&"-"&day(now)&"</td></tr>"&VBCRLF
calendar = calendar & " <tr bgcolor=#ffffff>"&VBCRLF
calendar = calendar & "<td>日</td>"&VBCRLF
calendar = calendar & "<td>一</td>"&VBCRLF
calendar = calendar & "<td>二</td>"&VBCRLF
calendar = calendar & "<td>三</td>"&VBCRLF
calendar = calendar & "<td>四</td>"&VBCRLF
calendar = calendar & "<td>五</td>"&VBCRLF
calendar = calendar & "<td>六</td>"&VBCRLF
calendar = calendar & "</tr>"&VBCRLF
calendar = calendar & VBCRLF&"<tr bgcolor=#ffffff>"&VBCRLF
'把前面的空白補(bǔ)充出來
nowmonthfirstiweekday = weekday(nowyear&"-"&nowmonth&"-1") - 2 '本月第一天的星期
For i=0 To nowmonthfirstiweekday
calendar = calendar & "<td bgcolor=#efefef> </td>"&VBCRLF
Next
'開始循環(huán)寫日期
t=1
For i=1 To monthdays
If year(now) = year(nowyear&"-"&nowmonth&"-"&i) and day(now) = day(nowyear&"-"&nowmonth&"-"&i) Then '高亮顯示今日
calendar = calendar & "<td bgcolor=#cccccc><a href=''>"&i&"</a></td>"&VBCRLF
Else
calendar = calendar & "<td>"&i&"</td>"&VBCRLF
End If
If weekday(nowyear&"-"&nowmonth&"-"&i) = 7 Then
t=t+1
calendar = calendar & "</tr><tr bgcolor=#ffffff>"&VBCRLF
End if
Next
For i=1 To (7*t-(nowmonthfirstiweekday+1+monthdays))
calendar = calendar & "<td bgcolor=#ffffff></td>"&VBCRLF
Next
calendar = calendar & VBCRLF&"</tr>"
calendar = calendar & "</table>"&VBCRLF
Response.Write calendar
%>
分享:asp從緩存讀數(shù)據(jù)實(shí)例從文件讀數(shù)據(jù),要比直接從數(shù)據(jù)庫快,測試讀出6000條新聞,讀數(shù)據(jù)庫用了23579毫秒,讀文件只用了123毫秒,下例為使用文件緩存的代碼 使用方法,在需要使用文件緩存的頁面加入下列代碼, !--#includefile=FileCatch.asp-- % SetMyCatch=newCatchFile MyCatch.Overdue=10
- asp FSO 讀寫文件本文件實(shí)現(xiàn)代碼
- asp中isNull、isEmpty和空字符串的區(qū)別
- asp獲取用戶真實(shí)IP地址的方法
- asp連接sqlserver數(shù)據(jù)庫實(shí)現(xiàn)代碼
- asp中正則表達(dá)式過濾html代碼函數(shù)
- asp中g(shù)et post提交表單區(qū)別
- 網(wǎng)頁模板:ASP內(nèi)建對象Request
- xmlhttp的open方法使用詳解
- ASP的常用的自定義函數(shù)大全
- asp中用for循環(huán)的一個小技巧
- eWebEditor v3.8 列目錄
- ASP無組件分頁實(shí)現(xiàn)思路及代碼
- 相關(guān)鏈接:
- 教程說明:
ASP教程-asp制作的日歷程序
。