网站首页
关于深山
客户案例
业务范围
联系深山
网络投票系统
企业网站建设
旅行社网站建设
小程序
留言板
技术文章
许愿墙(qq爱墙)
技术首页
百度小程序开发
微信小程序开发
微信公众号开发
uni-app
asp函数库
ASP
asp.net
DIV+CSS
HTML
SEO搜索引擎忧化
下载类信息
个人空间
代码生成
电商
python
页面特效
表格特效
导航菜单
图形特效
表单特效
时间日期
色彩类别
链接特效
网页特效
系统硬件
网站公告
网页学习
技术类文章
网站类信息
订阅本栏目 RSS
您所在的位置:
深山工作室
>
ASP
> 正文
asp日历代码
深山行者个人网站 2009/12/22 14:07:45 深山行者 字体:
大
中
小
浏览 12941
演示效果
以下为详细代码
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <link href="http://purl.org/dc" rel="schema.DC" /> <title>asp日历代码</title ></head> <body bgcolor="#FFFFFF"> <% ' 要调用的函数声明 '根据年份及月份得到每月的总天数 Function GetDaysInMonth(iMonth, iYear) Select Case iMonth Case 1, 3, 5, 7, 8, 10, 12 GetDaysInMonth = 31 Case 4, 6, 9, 11 GetDaysInMonth = 30 Case 2 If IsDate("February 29, " & iYear) Then GetDaysInMonth = 29 Else GetDaysInMonth = 28 End If End Select End Function '得到一个月开始的日期. Function GetWeekdayMonthStartsOn(dAnyDayInTheMonth) Dim dTemp dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth) GetWeekdayMonthStartsOn = WeekDay(dTemp) End Function '得到当前一个月的上一个月. Function SubtractOneMonth(dDate) SubtractOneMonth = DateAdd("m", -1, dDate) End Function '得到当前一个月的下一个月. Function AddOneMonth(dDate) AddOneMonth = DateAdd("m", 1, dDate) End Function ' 函数声明结束 Dim dDate ' 日历显示的日期 Dim iDOW ' 每一月开始的日期 Dim iCurrent ' 当前日期 Dim iPosition ' 表格中的当前位置 ' 得到选择的日期并检查日期的合法性 If IsDate(Request.QueryString("date")) Then dDate = CDate(Request.QueryString("date")) Else If IsDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Then dDate = CDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" & Request.QueryString("year")) Else dDate = Date() If Len(Request.QueryString("month")) <> 0 Or Len(Request.QueryString("day")) <> 0 Or Len(Request.QueryString("year")) <> 0 Or Len(Request.QueryString("date")) <> 0 Then Response.Write "您所选择的日期格式不正确,系统会使用当前日期.<BR><BR>" End If End If End If '得到日期后我们先得到这个月的天数及这个月的起始日期. iDIM = GetDaysInMonth(Month(dDate), Year(dDate)) iDOW = GetWeekdayMonthStartsOn(dDate) %> <table width="180" height="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td><table width="150" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="5"> </td> </tr> </table> <table width="180" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td align="center" colspan="7"><table border="0" cellpadding="0" cellspacing="0"width="100%"> <tr> <td height="22" align="right"><a href="rl.asp?date=<%= SubtractOneMonth(dDate) %>"><img src="../images/dot_left.gif" width="15" height="14" border="0" /></a></td> <td align="center"><font color="999999"><b><%= MonthName(Month(dDate)) & " " & Year(dDate) %></b></font></td> <td><a href="rl.asp?date=<%= AddOneMonth(dDate) %>"><img src="../images/dot_right.gif" width="15" height="14" border="0" /></a></td> </tr> </table></td> </tr> <tr> <td width="25" height="22" align="center"><font color="d08c00"><b>日</b></font> </td> <td width="25" align="center"><b><font color="999999">一</font></b> </td> <td width="25" align="center"><b><font color="999999">二</font></b> </td> <td width="25" align="center"><b><font color="999999">三</font></b> </td> <td width="25" align="center"><b><font color="999999">四</font></b> </td> <td width="25" align="center"><b><font color="999999">五</font></b> </td> <td width="25" align="center"><b><font color="d08c00">六</font></b> </td> </tr> <% ' 如果这个月的起始日期不是周日的话就加空的单元. If iDOW <> 1 Then Response.Write vbTab & "<TR>" & vbCrLf iPosition = 1 Do While iPosition < iDOW Response.Write vbTab & vbTab & "<TD> </TD>" & vbCrLf iPosition = iPosition + 1 Loop End If ' 绘制这个月的日历 iCurrent = 1 iPosition = iDOW Do While iCurrent <= iDIM ' 如果是一行的开头就使用 TR 标记 If iPosition = 1 Then Response.Write vbTab & "<TR>" & vbCrLf End If ' 如果这一天是我们选择的日期就高亮度显示该日期. If iCurrent = Day(dDate) Then Response.Write vbTab & vbTab & "<TD BGCOLOR=#eeeeee height=18 align=center><B>" & iCurrent & "</B></TD>" & vbCrLf Else Response.Write vbTab & vbTab & "<TD height=18 align=center><A HREF=""./rl.asp?date=" & Month(dDate) & "-" & iCurrent & "-" & Year(dDate) & """>" & iCurrent & "</A></TD>" & vbCrLf End If ' 如果满一周的话表格就另起一行 If iPosition = 7 Then Response.Write vbTab & "</TR>" & vbCrLf iPosition = 0 End If iCurrent = iCurrent + 1 iPosition = iPosition + 1 Loop ' 如果一个月不是以周六结束则加上相应的空单元. If iPosition <> 1 Then Do While iPosition <= 7 Response.Write vbTab & vbTab & "<TD> </TD>" & vbCrLf iPosition = iPosition + 1 Loop Response.Write vbTab & "</TR>" & vbCrLf End If %> </table> <table width="150" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td height="5"> </td> </tr> </table></td> </tr> </table>
前一页:
ASP汉字转拼音,支持自定义特殊词语
后一页:
asp 当日访问量,全部访问量,当前在线人数统计
相关阅读
jquery实现下拉加载更多
浅谈 Vista系统设置IIS7攻略
css里media属性详解
做好的网站把http改成https申请SSL域名证书
Shopify 店铺被封原因与防范及如何解封办法
Vista中使用IIS 7.0三个常见问题
经典的仿蓝色理想TAB横向下拉菜单效果
纯asp根据当前日期计算出当前年份的属相
更多信息>>
栏目类别选择
百度小程序开发
微信小程序开发
微信公众号开发
uni-app
asp函数库
ASP
DIV+CSS
HTML
python
更多>>
同类信息
ASP中Utf-8与Gb2312编码转换乱码问题的解决方法页面编码声明
asp显示随机密码
通过阿里云服务接口获得ip地址详细信息
iis点开后任务栏上有显示,但是窗口看不到的解决办法
RSA加密解密插件
微软Encoder加密解密函数
更多>>
最新添加文章
dw里面查找替换使用正则删除sqlserver里面的CONSTRAINT
Android移动端自动化测试:使用UIAutomatorViewer与Selenium定位元素
抖音直播音挂载小雪花 懂车帝小程序
javascript获取浏览器指纹可以用来做投票
火狐Mozilla Firefox出现:无法载入您的Firefox配置文件 它可能已经丢失 或是无法访问 问题解决集合处理办法
在Android、iOS、Windows、MacOS中微信小程序的文件存放路径
python通过代码修改pip下载源让下载库飞起
python里面requests.post返回的res.text还有其它的吗
更多>>
随机抽取信息
利用CSS制作的网站中新闻文章列表效果
层展开/关闭 - 运动缓冲效果
汽车交易网站
连云港旅游协会
关于字体在CSS中处理效果的思考
百度蜘蛛饲养技巧
更多标签
热门标签
下载
十字
时间
浮动
首页
计划
input
DropShadow
asp
读取
防止
上 下 左 右
lightbox
项目
断线
文件夹
VBScript
轮流
显示
Application
渐变
clear
比例
蜘蛛
设计
墙
导出
png
过期
素材
版权
列表
网站地图
对象
加密
list
游戏
web
ajax
tab
二级
列
操作
float
保留
代码 css
div CSS
左 右 全 input
div
原则
免责声明:本站所有资料信息,有部分为本人原创,部分为从网络收集而来,仅供网友查看阅读所用,所有信息版权归信息所有人或所有公司所有
如果信息内容侵犯到您的版权或权益请与我们联系,经确认后我们会立即移除相关内容或链接
Copyright © 2007-2026
深山工作室
All Rights Reserved
服务QQ:
565449214
手机:
13961347334
ICP备案:
苏ICP备15019627号
苏公网安备 32070502010230号