经典 ASP formatnumber 错误

Classic ASP formatnumber error

我是经典 asp 的新手,所以我试图理解下面导致错误的代码

<input class="uploadCalcField" type="text"  size="12" name="<%="upload" & "z" & rs("e_cat_id") & "z" & l2_id & "z" & l1_id%>" value="<%=formatnumber(Request.Form("upload" & "z" & rs("e_cat_id") & "z" & l2_id & "z" & l1_id), 0)%>" onClick="this.blur();">

错误是

type mismatch: 'formatnumber'.

我检查了

的输出
Request.Form("upload" & "z" & rs("e_cat_id") & "z" & l2_id & "z" & l1_id)

它是空的,这似乎是原因,任何人都可以帮助我理解错误吗?

FormatNumber() 失败,因为正如您在问题中指出的那样,它试图格式化的来自 Request.Form() 的值是空的。

Request.Form collection 由 Classic ASP 在 HTML 表单提交到 Classic ASP 时使用 POST method.

这是一个简单的例子

<html>
  <head>
    <title>Test Form Submission to Classic ASP</title>
  </head>

  <body>
    <form method="POST" action="/test.asp">
      <input type="text" name="testinput" value="hello world" />
      <input type="submit" value="Submit Form" />
    </form>
  </body>
</html>

当在浏览器中按下 Submit Form 按钮时,将生成一个 HTTP 请求并发送到 Web 服务器,在本例中为经典 ASP 进行处理。

POST http://example.com/test.asp HTTP/1.1
Host: example.com

testinput=hello%20world

*更多 headers 将被传递但被删除以保持示例简单

经典 ASP 获取 key-value 对的字符串并填充 Request.Form collection

test.asp (在HTML页面按下Submit Form按钮时调用)

<%
Call Response.Write(Request.Form("testinput"))
%>

输出:

hello world