2017-01-30 40 views
0

我似乎無法找到代碼中的錯誤。它旨在從HTML表單中輸出從用戶處獲取的變量的時間表。我得到了500編程錯誤。無法看到我的經典ASP代碼有什麼問題

<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> 
+2

爲了看到錯誤而不是一個普通的HTTP 500隨訪[A:不能看到傳統的ASP網站的錯誤(http://stackoverflow.com/a/11866550/692942)。 – Lankymart

+0

謝謝,我會檢查出 –

回答

2

你缺少一個ThenIf isValid

應該

If isValid Then 

和邏輯問題

If mult > 12 And mult < 1 Then 

將永遠不會計算到True,因爲ŧ他mult變量不能大於12且小於1(同時)。

您應該改用Or運算符。

If mult > 12 Or mult < 1 Then 
+0

謝謝,別的嗎?還是應該工作?我不能運行它,因爲服務器在學校 –

+0

@NickHofmann這將工作。 –