| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1470 人关注过本帖
标题:发一个用ASP写的万年历程序
只看楼主 加入收藏
robinbest
Rank: 1
等 级:新手上路
威 望:2
帖 子:213
专家分:0
注 册:2007-9-13
结帖率:0
收藏
 问题点数:0 回复次数:3 
发一个用ASP写的万年历程序
在网上找了很久的万年历程序,基本上都是用JScript写的,
昨天终于让我找到了个用纯ASP写的,帖出来分享一下:


<style type="text/css">
<!--
a:link {
    text-decoration: none;
}
a:visited {
    text-decoration: none;
}
a:hover {
    text-decoration: none;
}
a:active {
    text-decoration: none;
}
-->
</style>
<%
y=request.querystring("y")
m=request.querystring("m")
d=request.querystring("d")

if y="" then
    y=year(date)
    m=month(date)
    d=day(date)
end if

call blogdate(y,m,d)

'=====================以年月日为参数的显示==============================================
sub blogdate(y,m,d)   '
str1="&nbsp;&nbsp;&nbsp;当前的日期是"&y&"年"&m&"月"&d&"日&nbsp;&nbsp;&nbsp;"   '得到当前日期的年月日
nowdate=y&"-"&m&"-"&d
lastdate=dateadd("m",-1,nowdate)
lasty=year(lastdate)
lastm=month(lastdate)
nextdate=dateadd("m",1,nowdate)
nexty=year(nextdate)
nextm=month(nextdate)
str1=str1&"<a href="&request.servervariables("path_info")&"?y="&lasty&"&m="&lastm&"&d=1"&">上一月</a>&nbsp;"
str1=str1&"<a href="&request.servervariables("path_info")&"?y="&nexty&"&m="&nextm&"&d=1"&">下一月</a>&nbsp;"
str1=str1&"<a href="&request.servervariables("path_info")&">返回今日</a>"
response.write str1
thismonth=y&"-"&m&"-1"    '当前月的第一天
nextmonth=dateadd("m",1,thismonth)  '下个月的第一天
num=datediff("d",thismonth,nextmonth)  '当前月的天数
firstday=weekday(thismonth)-1   '得到当前月第一天的星期
'call displaydate(firstday,num)
Response.Write "<table border=1 width=""40%""  style=""border-collapse:collapse"">" & vbCrlf
Response.Write "<tr>" & vbCrlf
Response.Write "<td align=""center"">星期日</td>" & vbCrlf
Response.Write "<td align=""center"">星期一</td>" & vbCrlf
Response.Write "<td align=""center"">星期二</td>" & vbCrlf
Response.Write "<td align=""center"">星期三</td>" & vbCrlf
Response.Write "<td align=""center"">星期四</td>" & vbCrlf
Response.Write "<td align=""center"">星期五</td>" & vbCrlf
Response.Write "<td align=""center"">星期六</td>" & vbCrlf
Response.Write "</tr>" & vbCrlf
'需要参数:当前月第一天的星期firstday,当前月的天数num
for n=1 to 6
response.write "<tr>"
    for i=1 to 7
    thisday=0
    if i>firstday then thisday=i-firstday
    if n>1 then thisday=7*(n-1)+i-firstday
    if thisday>num then thisday=0
      if thisday=0 then
      display="&nbsp;"
      else
      display="<a href="&request.servervariables("path_info")&"?y="&y&"&m="&m&"&d="&thisday&">"&thisday&"</a>"
      end if
    response.write "<td align=""center"">"&display&"</td>"
    next
    if n=5 and (thisday=num or thisday=0)  then n=n+1
response.write "</tr>"
next
Response.Write "</table>" & vbCrlf
end sub
'===================================================================
%>
搜索更多相关主题的帖子: 万年历 ASP 
2008-09-04 09:09
w421947545
Rank: 1
等 级:新手上路
帖 子:46
专家分:5
注 册:2008-7-30
收藏
得分:0 
ding一下.
2008-09-04 13:49
yangzeng
Rank: 1
等 级:新手上路
威 望:1
帖 子:277
专家分:0
注 册:2008-4-23
收藏
得分:0 
正需要呢,顶一下,不知道你使用了没有能用不
2008-09-05 21:58
nicechlk
Rank: 3Rank: 3
等 级:论坛游侠
威 望:4
帖 子:330
专家分:187
注 册:2008-9-6
收藏
得分:0 
可以用
就是没有农历,呵呵

莫以善小而不为,莫以恶小而为之!
2008-09-07 22:45
快速回复:发一个用ASP写的万年历程序
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017829 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved