ASP日期函数运用—生成简单的日历
2009-05-07 10:39:38 来源:WEB开发网<%@LANGUAGE="VBSCRipT" CODEPAGE="65001"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/CSS">
body{
font-size:12px;
}
table{
text-align:center;
}
#curr{
background-color:#CC99CC;
}
</style>
</head>
<body>
<%
dim lines,currY,currD,firDate,firWeek,maxDay,days
sub cal(dateStr)
if dateStr="" then
dateStr=date()
end if
currY=year(dateStr)
currM=month(dateStr)
currD=day(dateStr)
firDate=currY&"-"&currM&"-1"
firWeek=weekDay(firDate)
maxDay=day(dateSerial(y,m+1,0))
days=maxDay+firWeek-1
if days mod 7 = 0 then
lines=int(days/7)-1
else
lines=fix(days/7)
end if
end sub
'这样就生成2008年8月的日历
'ds="2008-8-8"
'call cal(ds)
call cal("")
%>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25" height="25">日</td>
<td width="25" height="25">一</td>
<td width="25" height="25">二</td>
<td width="25" height="25">三</td>
<td width="25" height="25">四</td>
<td width="25" height="25">五</td>
<td width="25" height="25">六</td>
</tr>
<%for i=0 to lines%>
<tr>
<%
for j=1 to 7
square=7*i+j-firWeek+1
if square<1 or square>maxDay then
response.Write("<td width='25' height='25'> </td>")
elseif square=currD then
response.Write("<td width='25' height='25' id='curr'>"&square&"</td>")
else
response.Write("<td width='25' height='25'>"&square&"</td>")
end if
next
%>
</tr>
<%next%>
</table>
</body>
</html>
- ››asp.net页面弄成伪静态页面
- ››Asp.net 中将汉字转换成拼音的方法
- ››ASP.NET及JS中的cookie基本用法
- ››ASP.NET获取MS SQL Server安装实例
- ››asp.net实现调用百度pai 在线翻译英文转中文
- ››ASP.NET页面选项进行提示判断
- ››Asp.net定时执行程序
- ››ASP.NET中利用DataList实现图片无缝滚动
- ››ASP.NET验证控件RequiredFieldValidator
- ››ASP.NET中使用System.Net.Mail发邮件
- ››ASP.NET中获取用户控件中控件的ID
- ››ASP.NET中FileBytes写成文件并存档
更多精彩
赞助商链接