📄 calendar.asp
字号:
<%
dim selectdate,l_time,cat_id,linkcount,blogmonth
selectdate=Request("date")
redim linkdays(2,0)
linkcount=0
blogmonth=trim(request.QueryString("month"))
dim ccode
sub calendar()
'response.Write selectdate
dim ca_bg_color,ca_head_color,ca_week_color,ca_day_color,ca_nowday_color
dim thisbgcolor,ca_today_color,ca_headtext_color
dim c_year,c_month,c_day,logdate,today,tomonth,toyear,sql,s,count,b,c
dim thismonth,thisdate,thisyear,startspace,nextmonth,nextyear,promonth,proyear,linktrue
dim rs_month
'getsearchcode
'====================================================日历代码
ca_bg_color="" '日历背景即边线颜色
ca_head_color="" '头部颜色
ca_week_color="" '星期栏颜色
ca_day_color="" '主背景色
ca_nowday_color="" '按日查看时所查看日的颜色
ca_today_color="" '今天的颜色
ca_headtext_color="" '首部年月文字的颜色
if selectdate="" then
c_year=year(blognow())
c_month=month(blognow())
c_day=0
else
c_year=year(selectdate)
c_month=month(selectdate)
c_day=day(selectdate)
end if
if blogmonth<>"" then
c_year=year(blogmonth)
c_month=month(blogmonth)
c_day=day(blogmonth)
end if
logdate=c_year&"-"&c_month
c_year=cint(c_year)
c_month=cint(c_month)
c_day=cint(c_day)
'===============================================添加连接
if issqldate then
dim cmd,rs
Set cmd = Server.CreateObject("ADODB.Command")
Set Cmd.ActiveConnection=conn
Cmd.CommandText="ob_calendar"
Cmd.CommandType=4
Cmd("@logdate")=logdate
Cmd("@show_username")=show_username
set rs_month=cmd.Execute
set cmd=nothing
else
sql="SELECT addtime FROM blog WHERE datediff('n','"&logdate&"',addtime)>0 and username='"&show_username&"'"
set rs_month=conn.EXECUTE(sql)
end if
'response.write sql
dim theday
theday=0
do while not rs_month.eof
if day(rs_month("addtime"))<>theday then
theday=day(rs_month("addtime"))
redim preserve linkdays(2,linkcount)
linkdays(0,linkcount)=month(rs_month("addtime"))
linkdays(1,linkcount)=day(rs_month("addtime"))
linkdays(2,linkcount)="blog.asp?name="&show_username&"&date="&logdate&"-"&theday
linkcount=linkcount+1
end if
rs_month.MoveNext
Loop
set rs_month=nothing
'===================================================
dim mname(12)
mname(0)=""
mname(1)="January "
mname(2)="February "
mname(3)="Mar."
mname(4)="April "
mname(5)="may "
mname(6)="June "
mname(7)="July "
mname(8)="August "
mname(9)="September "
mname(10)="October "
mname(11)="November "
mname(12)="December "
dim mdays(12)
mdays(0)=""
mdays(1)=31
mdays(2)=28
mdays(3)=31
mdays(4)=30
mdays(5)=31
mdays(6)=30
mdays(7)=31
mdays(8)=31
mdays(9)=30
mdays(10)=31
mdays(11)=30
mdays(12)=31
'今天的年月日
today=day(blognow())
tomonth=month(blognow())
toyear=year(blognow())
'指定的年月日及星期
thismonth=c_month
thisdate=c_day
thisyear=c_year
If IsDate("February 29, " & thisyear) Then mdays(2)=29
'确定日历1号的星期
startspace=weekday( thismonth&"-1-"&thisyear )-1
nextmonth=c_month+1
nextyear=c_year
if nextmonth>12 then
nextmonth=1
nextyear=nextyear+1
end if
promonth=c_month-1
proyear=c_year
if promonth<1 then
promonth=12
proyear=proyear-1
end if
ccode="<table border='0' width='100%' align='center' cellspacing='1' cellpadding='1' bgcolor='"&ca_bg_color&"'>"
ccode=ccode&"<tr><td colspan='1' bgcolor='"&ca_head_color&"' style='font-size:16px; font-family:;text-align :right'><a href='blog.asp?name="&show_username&"&month="&proyear&"-"&promonth&"'>«</a></td><td colspan='5' style='color:"&ca_headtext_color&";font-size:14px;font-family:;text-align :center'><b>"&mname(thismonth)& thisyear&"</b></td><td colspan='1' bgcolor='"&ca_head_color&"' style='font-size:16px; font-family:;text-align :left';><a href='blog.asp?name="&show_username&"&month="&nextyear&"-"&nextmonth&"'>»</a></td></tr><tr>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'>日</td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'>一</td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'>二</td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'>三</td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'>四</td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'>五</td>"
ccode=ccode&"<td align='center' bgcolor='"&ca_week_color&"'>六</td></tr><tr>"
for s=0 to startspace-1
ccode=ccode&"<td bgcolor='"&ca_day_color&"'></td>"
next
count=1
while count<=mdays(thismonth)
for b=startspace to 6
thisbgcolor=ca_day_color
if count=today and thisyear=toyear and thismonth=tomonth then thisbgcolor=ca_today_color
if count=thisdate then thisbgcolor=ca_nowday_color
ccode=ccode&"<td align='center' bgcolor='"&thisbgcolor&"' style='font-size:10px;font-family:'>"
linktrue="false"
for c=0 to ubound(linkdays,2)
if linkdays(0,c)<>"" then
if linkdays(0,c)=thismonth and linkdays(1,c)=count then
ccode=ccode&"<a href='"&linkdays(2,c)&"'>"
linktrue="true"
end if
end if
next
if count<=mdays(thismonth) then ccode=ccode&count
if linktrue="true" then ccode=ccode&"</a>"
ccode=ccode&"</td>"
count=count+1
next
ccode=ccode&"</tr>"
startspace=0
wend
'ccode=ccode&"</table>"
ccode=ccode&"<tr><td colspan='7' bgcolor='"&ca_week_color&"' align='center'>"
'ccode=ccode&"<a href='index.asp?vt=bymonth&l_year="&proyear&"&l_month="&promonth&"'><span class='arrow'>3</span></a><b> MONTH </b><a href='index.asp?vt=bymonth&l_year="&nextyear&"&l_month="&nextmonth&"'><span class='arrow'>4</span></a> <a href='index.asp?vt=byyear&l_year="&l_year-1&"&l_month="&l_month&"'><span class='arrow'>3</span></a><b> YEAR </b><a href='index.asp?vt=byyear&l_year="&l_year+1&"&l_month="&l_month&"'><span class='arrow'>4</span></a>"
ccode=ccode&"</tr></table>"
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -