经典的asp包括
我试图将一些 asp 逻辑分离到一个单独的页面中。 现在,我正在尝试调用一个简单的函数。
这是我正在使用的简单索引页
<html>
<head>
<title>Calling a webservice from classic ASP</title>
</head>
<body>
<%
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
%>
<!--#include file="aspFunctions.asp"-->
<%
doStuff()
End If
%>
<FORM method=POST name="form1" ID="Form1">
ID:
<INPUT type="text" name="corpId" ID="id" value="050893">
<BR><BR>
<INPUT type="submit" value="GO" name="submit1" ID="Submit1" >
</form>
</body>
</html>
这是 aspfunctions.asp
sub doStuff()
Response.Write("In Do Stuff")
end sub
当我点击表单上的提交按钮时,我得到以下内容 sub doStuff() Response.Write("In Do Stuff") end sub
Microsoft VBScript 运行时错误 '800a000d'
有谁知道我可能做错了什么?
非常感谢任何帮助
谢谢 达米安 类型不匹配:'doStuff'
/uat/damien/index.asp,第 15 行
I am trying to separate some asp logic out into a separate page.
For now, I am trying to call a simple function.
Here is the simple index page that I am using
<html>
<head>
<title>Calling a webservice from classic ASP</title>
</head>
<body>
<%
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
%>
<!--#include file="aspFunctions.asp"-->
<%
doStuff()
End If
%>
<FORM method=POST name="form1" ID="Form1">
ID:
<INPUT type="text" name="corpId" ID="id" value="050893">
<BR><BR>
<INPUT type="submit" value="GO" name="submit1" ID="Submit1" >
</form>
</body>
</html>
Here is aspfunctions.asp
sub doStuff()
Response.Write("In Do Stuff")
end sub
When i hit the submit button on my form i get the below
sub doStuff() Response.Write("In Do Stuff") end sub
Microsoft VBScript runtime error '800a000d'
Does anyone have any idea what i could be doing wrong?
Any help is greatly appreciated
Thanks
Damien
Type mismatch: 'doStuff'
/uat/damien/index.asp, line 15
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您必须在 <% %> 内包含 asp 函数。 标签。
You must have the asp functions inside the <% %> tag.
aspfunctions.asp
应该位于标签内,以便“执行”asp,例如aspfunctions.asp 文件:
否则
aspfunctions.asp
中的 asp 仅被视为纯文本,所以就服务器而言,doStuff
从未被定义过。aspfunctions.asp
should be inside tags so the asp is "executed", e.g.aspfunctions.asp file:
Otherwise the asp in
aspfunctions.asp
is just seen as plain-text, so as far as the server is concerned,doStuff
has never been defined.您将另一个文件包含在 if 语句中。 这并不意味着它是动态包含的,事实并非如此。 它将永远被包括在内。
要查看实际效果,请尝试以下示例:
You're including the other file within an if statement. This does not mean that it's dynamically included, it's not. It will always be included.
To see this in action try this sample:
如果我没记错的话,没有返回值的调用不需要括号(未经测试的解决方案):
If I remember correctly, you need no brackets for calls without a return value (untested solution):
在两个地方进行更改:
sub doStuff()
doStuff
而不是doStuff()
>Make changes in two places:
sub doStuff()
doStuff
notdoStuff()