求助——日历表中怎样实现标记

onecell 2006-09-06 12:34:46
怎样给日期加上颜色?比如说今天是6号,让日历表中当前日期6号变成橙色,其他为黑色?让颜色随日期号的改变自动改变。
最好是VBSCRIPT的源代码
谢谢了!!
...全文
349 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
heyang714 2006-09-06
  • 打赏
  • 举报
回复
xxf0xxf(超级大菜鸟.充电中..)
----------------
意见接受!
qq348797951 2006-09-06
  • 打赏
  • 举报
回复
看上面的注释就知道怎么回事了哈
qq348797951 2006-09-06
  • 打赏
  • 举报
回复
<%
'月份名称定义
Dim Month_Name(12)
Month_Name(1) = "一月"
Month_Name(2) = "二月"
Month_Name(3) = "三月"
Month_Name(4) = "四月"
Month_Name(5) = "五月"
Month_Name(6) = "六月"
Month_Name(7) = "七月"
Month_Name(8) = "八月"
Month_Name(9) = "九月"
Month_Name(10) = "十月"
Month_Name(11) = "十一月"
Month_Name(12) = "十二月"

'年份处理,默认值为服务器当前年份
if request.querystring("year")<>"" then
Year_var=cint(request.querystring("year"))
else
Year_var=year(date())
end if

'上一年、下一年赋值
Previous_year=Year_var-1
Next_year=Year_var+1


'月份处理,默认值为服务器当前月份
if request.querystring("Month")<>"" then
Month_var=cint(request.querystring("Month"))
else
Month_var=month(date())
end if

'上一月、下一月赋值
if Month_var<=1 then
Next_month=Month_var+1
Previous_month=1
else
if Month_var>=12 then
Next_month=12
Previous_month=Month_var-1
else
Next_month=Month_var+1
Previous_month=Month_var-1
end if
end if

'当前天数定位计算
First_day=DateSerial(Year_var,Month_var,1)
Current_day=First_day-weekday(First_day)+2

%>
<html>
<head>
<title>日历</title>
<style>
<!--
.page { text-decoration: none; color: #CAE3FF; font-size:9pt;

font-family:Webdings }
.dayTable { border: 1px dotted #E6E6E6; padding-left: 4;

padding-right: 4; padding-top: 1; padding-bottom: 1}
.day { font-family: "Arial"; font-size: 9pt; color: #000000 }
:hover.day { font-family: Arial; font-size: 9pt; text-decoration:

none; color: #FF0000 }
.title { font-family: Arial; font-size: 9pt; color: #FFFFFF;

font-weight: bold }
:hover.page { text-decoration: underline; color: #FFFFFF;

font-family:Webdings; font-size:9pt }
-->
</style>
</head>
<body topmargin="0" leftmargin="0" onLoad="window.focus();">
<div align="center">
<center>
<table width="" border="0" cellspacing="1" cellpadding="1">
<tr>
<td><table width="100%" border="0" cellspacing="1" cellpadding="1">
<tr>
<td><div align="center"><a href="date.asp?year=<%=Previous_year%>&month=<%=Month_var%>" title="前年" class="page"><font color="#000000">7</font></a>
<a href="date.asp?year=<%=Year_var%>&month=<%=Previous_month%>" title="上月" class="page"><font color="#000000">3</font></a></div></td>
<td width="60%" align="center" class="title"><font color="#000000"><%response.write Month_Name(Month_var) & " " & Year_var & "年"%></font></td>
<td width="20%" align="center">
<a href="date.asp?year=<%=Year_var%>&month=<%=Next_month%>" title="下月" class="page"><font color="#000000">4</font></a>
<a href="date.asp?year=<%=Next_year%>&month=<%=Month_var%>" title="明年" class="page"><font color="#000000">8</font></a></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="1" cellspacing="1" class="day">
<tr>
<td><div align="center">一</div></td>
<td><div align="center">二</div></td>
<td><div align="center">三</div></td>
<td><div align="center">四</div></td>
<td><div align="center">五</div></td>
<td><div align="center">六</div></td>
<td><div align="center">日</div></td>
</tr>
<%
'日历内容 5行*7例 显示
'外层循环显示控制行
for i=0 to 4
%>
<tr>
<%
'内层循环显示控制列

for j=0 to 6
response.write "<td align=center class=dayTable"

'天数显示,“今天”显示

if Current_day = date then
response.write " bgcolor=red>"
%><b><%=day(Current_day)%></b><%
else

'天数显示,非本月天数显示
if Month(Current_day) <> Month_var then
response.write " bgcolor=#F0F0F0>"
%>
<font color="#CCCCCC"><%=day(Current_day)%></font><%
else

'天数显示,本月天数显示
response.write ">"
%>
<%=day(Current_day)%><%
end if

end if

'天数累加推算

Current_day = Current_day + 1
response.write "</td>"
next
%>

</tr>
<%next%>
</table></td>
</tr>
</table>
</center>
</div>
</body>
</html>
xxf0xxf 2006-09-06
  • 打赏
  • 举报
回复
好像8月也是31天
heyang714 2006-09-06
  • 打赏
  • 举报
回复
直接运行即可....
heyang714 2006-09-06
  • 打赏
  • 举报
回复
<%
function getdays(year,month)
select case month
case 1,3,5,7,10,12:
getdays=31
case 4,6,9,11:
getdays=30
case 2:
if isdate("February 29,"&year) then
getdays=29
else
getdays=28
end if
end select
end function

function getweek(year,month)
getweek=weekday(month&"/1/"&year)
end function
%>
<html>
<style type="text/css">
<!--
.style4 {font-size: xx-small}
-->
</style>
<body>

<table width="200" border="0" align="center">
<tr>
<td width="200">
<div align="center" class="style4"><br>
<%if request("year")="" then
response.write "2006"
else
response.write request("year")
end if
%>年
<%if request("month")="" then
response.write "9"
else
response.write request("month")
end if
%>月日历
</div>
</table>
<br>
<table width="200" border="0" align="center" class="style4" bgcolor="#FFFFFF">
<tr>
<td>日</td>
<td>一</td>
<td>二</td>
<td>三</td>
<td>四</td>
<td>五</td>
<td>六</td>
</tr>
<%
dim days
dim week
if request("year")<>"" then
days=getdays(request("year"),request("month"))
week=getweek(request("year"),request("month"))
else
days=getdays(2006,9)
week=getweek(2006,9)
end if
response.write "<tr>"
if week<>1 then
position=1
do while position<week
response.write "<td> </td>"
position=position+1
loop
end if
current=1
position=week
do while current<=days
if cint(day(now))=current then
response.write "<td><span style=background:#FF0000>"¤t&"</span></td>" (当前日期红色)
else
response.write "<td>"¤t&"</td>" (非当前日期默认)
end if
if position=7 then
position=0
response.write "</tr>"
end if
current=current+1
position=position+1
loop
if position<>1 then
do while position<>8
response.write "<td> </td>"
position=position+1
loop
response.write "</tr>"
end if
%>
</body>
</html>

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧