修罗特种兵安妙依结局:<input type="button" onclick="DayOfWeek()" value="日期判断" name="B6"></input>无法调用SUB怎么回事?

来源:百度文库 编辑:神马品牌网 时间:2024/04/30 06:17:07
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>
<body>

<%
Sub DayOfWeek()
Dim day1
Dim temp
Dim tempstr
day1=Inputbox("请输入你选择的日期格式为yy-mm-dd",1)
If Not IsDate(day1) then
msgbox "青葱新输入"
Else
temp=WeekDay(Cdate(day1))
Select Case temp
case 1
tempstr="ri"
case 2
tempstr="yi"
case 3
tempstr="er"
case 4
tempstr="san"
case 5
tempstr="si"
case 6
tempstr="wu"
case 7
tempstr="liu"
End Select
msgbox "riqshi"&tempstr
End If
End Sub
%>
</script>
<body>
<input type="button" onclick="DayOfWeek()" value="日期判断" name="B6"></input>
</body>

</form>
</body>
Active Server Pages, ASP 0221 (0x80004005)
指定的'runat=server' 选项未知或无效。
/index.asp, 第 10 行

在第一行写
<% @ language=vbscript%>

这是指定脚本语言为vbscript 这样才可以调用过程
对不起少个空格 runat 写不写都可以的

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
</head>
<body>
<script language=vbscript runat=server>

Sub DayOfWeek()
Dim day1
Dim temp
Dim tempstr
day1=Inputbox("请输入你选择的日期格式为yy-mm-dd",1)
If Not IsDate(day1) then
msgbox "青葱新输入"
Else
temp=WeekDay(Cdate(day1))
Select Case temp
case 1
tempstr="ri"
case 2
tempstr="yi"
case 3
tempstr="er"
case 4
tempstr="san"
case 5
tempstr="si"
case 6
tempstr="wu"
case 7
tempstr="liu"
End Select
msgbox "riqshi"&tempstr
End If
End Sub
</script>
<body>
<input type="button" onclick="DayOfWeek()" value="日期判断" name="B6"></input>
</body>

</form>
</body>