小问题

jinqiangkejiao 2008-03-23 10:59:22
请大家帮我看看这段代码有什么问题
<%
dim mMonth,mYear,,mDate
mMonth=Month(Date())
mYear=Year(Date())
mDate=Day(Date())
%>
<div align="center" style="background-color:#009933; color:#FFFFFF ">
<strong><%=mYear%>年<%=mMonth%>月</strong></div>
<%
Function CountDays(iMonth,iYear)
Select Case imonth
case 1,3,5,7,8,10,12
CountDays=31
case 2
if IsDate("2/29/"&iYear) Then
CountDays=29
else
CountDays=28
End if
case 4,6,9,11
CountDays=30
End Select
End Function
Function FirstDay(iMonth,iYear)
FirstDay=WeekDay(iMonth&"/1/"&iYear)
End Function
%>
<table width="90%", border="0" align="center" cellpadding="1" cellspacing="2" bgcolor="#00CC33">
<tr bgcolor="#CCFF00">
<td align="right">星期日</td>
<td align="right">星期一</td>
<td align="right">星期二</td>
<td align="right">星期三</td>
<td align="right">星期四</td>
<td align="right">星期五</td>
<td align="right">星期六</td>
</tr>
<tr bgcolor="#FFFFFF">
<%
j=1
for i=1 to 42
if i>=FirstDay(mMonth,mYear) and j<=CountDays(mMonth,mYear) then
if mDate=j then
response.write "<td align="right" bgcolor="#CC9933"><strong>
<font color="RED""&j&"</font></strong>"
else
response.write"<td align="right" bgcolor="#FFFFFF">"&j
end if
j=j+1
else
response.write"<td align="right" bgcolor="#FFFFFF">"&" "
end if
response.write"</td>"
if i mod 7=0 then
response.write"</tr><tr>"
end if
nest
%>
</tr></table>
</tr>

...全文
64 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
jinqiangkejiao 2008-03-31
怎么按照你们的代码依然不能显示日期。
回复
Dogfish 2008-03-25
<%
dim mMonth,mYear,,mDate

dim mMonth,mYear,mDate

mMonth=Month(Date())
mYear=Year(Date())
mDate=Day(Date())
%>
<div align="center" style="background-color:#009933; color:#FFFFFF ">
<strong> <%=mYear%>年 <%=mMonth%>月 </strong> </div>
<%
Function CountDays(iMonth,iYear)
Select Case imonth
case 1,3,5,7,8,10,12
CountDays=31
case 2
if IsDate("2/29/"&iYear) Then
CountDays=29
else
CountDays=28
End if
case 4,6,9,11
CountDays=30
End Select
End Function
Function FirstDay(iMonth,iYear)
FirstDay=WeekDay(iMonth&"/1/"&iYear)
End Function
%>
<table width="90%", border="0" align="center" cellpadding="1" cellspacing="2" bgcolor="#00CC33">
<tr bgcolor="#CCFF00">
<td align="right">星期日 </td>
<td align="right">星期一 </td>
<td align="right">星期二 </td>
<td align="right">星期三 </td>
<td align="right">星期四 </td>
<td align="right">星期五 </td>
<td align="right">星期六 </td>
</tr>
<tr bgcolor="#FFFFFF">
<%
j=1
for i=1 to 42
if i>=FirstDay(mMonth,mYear) and j <=CountDays(mMonth,mYear) then
if mDate=j then
response.write " <td align="right" bgcolor="#CC9933"> <strong><font color="RED""&j&" </font> /strong>"

response.write "<td align=right bgcolor=#CC9933> <strong><font color=RED" & j & "</font></strong>"

else
response.write" <td align="right" bgcolor="#FFFFFF">"&j

response.write "<td align=right bgcolor=#FFFFFF>" & j

end if
j=j+1
else
response.write" <td align="right" bgcolor="#FFFFFF">"&" "

response.write "<td align=right bgcolor=#FFFFFF>" & " "

end if
response.write" </td>"
if i mod 7=0 then
response.write" </tr> <tr>"
end if
nest

next

%>
</tr> </table>
回复
hookee 2008-03-23

<%
dim mMonth,mYear,mDate
mMonth=Month(Date())
mYear=Year(Date())
mDate=Day(Date())
%>
<div align="center" style="background-color:#009933; color:#FFFFFF ">
<strong> <%=mYear%>年 <%=mMonth%>月 </strong> </div>
<%
Function CountDays(iMonth,iYear)
CountDays = DateDiff("d", CDate(iYear & "-" & iMonth & "-1"),CDate(iYear & "-" & (iMonth+1) & "-1"))
End Function

Function FirstDay(iMonth,iYear)
FirstDay=WeekDay(iMonth & "/1/" & iYear)
End Function
%>
<table width="90%", border="0" align="center" cellpadding="1" cellspacing="2" bgcolor="#00CC33">
<tr bgcolor="#CCFF00">
<td align="right">星期日 </td>
<td align="right">星期一 </td>
<td align="right">星期二 </td>
<td align="right">星期三 </td>
<td align="right">星期四 </td>
<td align="right">星期五 </td>
<td align="right">星期六 </td>
</tr>
<%
j=1
for i=1 to 42
if i mod 7 = 1 then response.write "<tr bgcolor=""#FFFFFF"">"
if i>=FirstDay(mMonth,mYear) and j <=CountDays(mMonth,mYear) then
if mDate=j then
response.write " <td align=""right"" bgcolor=""#CC9933""> <strong><font color=""RED""" & j & " </font></strong>"
else
response.write" <td align=""right"" bgcolor=""#FFFFFF"">" & j
end if
j=j+1
else
response.write" <td align=""right"" bgcolor=""#FFFFFF"">"&" "
end if
response.write" </td>"
if i mod 7 = 0 then
response.write "</tr>"
end if
next
%>
</table>
回复
相关推荐
发帖
vbScript
创建于2007-09-28

4001

社区成员

它是一种微软环境下的轻量级的解释型语言,它使用COM组件、WMI、WSH、ADSI访问系统中的元素,对系统进行管理。
申请成为版主
帖子事件
创建了帖子
2008-03-23 10:59
社区公告
暂无公告