看不出我的经典ASP代码出了什么问题

时间:2017-01-30 21:22:48

标签: html asp-classic

我似乎无法在代码中找到错误。它的意思是从HTML表单输出从用户获取的变量的时间表。我得到500编程错误。

<html>
<head>
    <title>My Times Tables</title>
</head>
<body>
    <h1>Times Table: </h1>
    <%
        isValid = True
        mult = request.form("multiple")
        if not IsNumeric(mult) then
            isValid = False
            response.write("Not a number. Please try again...")
        end if
        if mult > 12 And mult < 1 then
            isValid = False
            response.write("Out of range. Please try again...")
        end if
        if isValid
        %>
            <table style="width:75%">
            <%
            For i = 1 to 12
                %>
                <tr>
                    <td><%= i %></td>
                    <td><%= mult %></td>
                    <th><%= (i * mult) %></th>
                </tr>
                <%
            Next
        end if
    %>
</body>
</html>

1 个答案:

答案 0 :(得分:2)

Then

之后,你错过了If isValid

应该是

If isValid Then

和逻辑问题

If mult > 12 And mult < 1 Then

永远不会评估为True,因为mult变量不能大于12且小于1(同时)。

您应该使用Or运营商。

If mult > 12 Or mult < 1 Then
相关问题