请教关于VBS的错误.

hankfernandez 2007-04-28 04:34:35
各位帮忙看下错误在哪呢?
错误提示信息是:
行:106
字符:1
错误:缺少'next'
----------------------------------------
<html>

<head>
<title>四季日历</title>
</head>

<BLOCKQUOTE>
<SCRIPT language=vbs>
<!--
documnet.open
call displaycalender()
doucment.close
'定义所需变量
'currentdate 表示当日在一周内所在的天,即几号
'currentday 表求当日在一周内所在的天,即星期几
'currentyear 表示当日所在年份
'currentmonth 表示当日所在月份
'xday 关键变量,表求日历中,月份开始时到1号所空的天数
dim currentdate, currentday,currentyear, currentmonth, xday
'下面得到与当日有关的日期信息
sub dayinfo
date_info=date()
currentdate=day(date_info)
currentday=weekday(date_info)-1
currentmonth=month(date_info)
currentyear=year(date_info)
tempday-currentdate mod 7
xday=(currentday+7-tempday) mod 7 +1
end sub
'下面的过程打印日历
sub displaycalender

'定义数组,表示每月的天数
dim alldays(11)
alldays(0)=31
alldays(1)=28
alldays(2)=31
alldays(3)=30
alldays(4)=31
alldays(5)=30
alldays(6)=31
alldays(7)=31
alldays(8)=30
alldays(9)=31
alldays(10)=30
alldays(11)=31

'定义数组,表示星期几的英文缩写
dim weekdayname(6)
weekdayname(0)="Su"'
weekdayname(1)="Mon"
weekdayname(2)="Tue"
weekdayname(3)="Wed"
weekdayname(4)="Thu"
weekdayname(5)="Fri"
weekdayname(6)="Sat"

dim monthname(11)
monthname(0)="Junuary"
monthname(1)="Februany"
monthname(2)="March"
monthname(3)="April"
monthname(4)="May"
monthname(5)="June"
monthname(6)="July"
monthname(7)="August"
monthname(8)="Sepetember"
monthname(9)="October"
monthname(10)="November"
monthname(11)="December"

'调用过程dayinfo,得到日期信息,存入公共变量中
call dayinfo

'测试闰年
if(currentyear mod 4=0) then alldays(1)=alldays(1)+1

'利用writeln函数向日葵浏览器窗口写入HTML代码
'先写HTML的头部分
document.writeln("<html>")
document.writeln("<head>")
document.writeln("<title>四季日历</title>")
document.writeln("</head>")
document.writeln("<body>")
'再写形成日历的表格,为了看清楚,在样式信息中定义了大字本
document.writeln("<tabel border=0 style ='font-size=32pt;text-align:center'>")
'书写表格的标题
document.writeln("<caption style='color:blue'>")
document.writeln(currentyear&monthname(currentmonth))
document.writeln("</caption>")
'书写表头,表头是星期几的英文名称
document.writeln("<tr>")
for i= 0 to 6
document.writeln("<th style='color:red'"&weekdayname(i)&"</th>")
next

document.writeln("</tr>")
'书写表体,循环次数为当月天数加上xday的天数
for i=1 to alldays(currentmonth)+xday
'如果写满了一周就换行
if(i mod 7=1)then document.writeln("<tr>")
'如果循环变量小于xday, 刚写出空的单元格
if(i<=xday) then document.writeln("<td></td>")
'否则写入正式的日期
else
'如果循环至当日,则采用另一种特殊的样式表示
if(i=currentdate+xday)then
document.writeln("<td style='color:lime'>"&(i-xday)&"</td>")
else
document.writeln("<td>"&(i-xday)&"</td>")
end if
end if
end if
'写满一周就换行
if(i mod 7=0)then document.writeln("</tr>")
next

'书写表尾和文档尾部
document.writeln("</tr>")
document.writeln("</table>")
document.writeln("</body>")
document.writeln("</html>")
end sub

-->
</SCRIPT>
</BLOCKQUOTE>
<body>

</body>

</html>
...全文
254 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
hankfernandez 2007-04-30
  • 打赏
  • 举报
回复
自己搞定了...
hankfernandez 2007-04-28
  • 打赏
  • 举报
回复
xday=(currentday+7-tempday) mod 7 +1

这个是一个经验公式,可以求出xday的值.
xday表示在日历中,月份开始时到1号所空的天数
即:
Sun Man Tue Wed Thu Fri Sat
1 2 3 4
5 6 7 8 9 10 11

这就是说,前面空了三天,xday=3
孟子E章 2007-04-28
  • 打赏
  • 举报
回复
写的太乱了

tempday-currentdate mod 7
什么意思?

documnet.open
-->

document.open

其它还有

61,112

社区成员

发帖
与我相关
我的任务
社区描述
层叠样式表(英文全称:Cascading Style Sheets)是一种用来表现HTML(标准通用标记语言的一个应用)或XML(标准通用标记语言的一个子集)等文件样式的计算机语言。
社区管理员
  • HTML(CSS)社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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