经典ASP:在VBScript中返回的形式调用VBscript函数

经典ASP:在VBScript中返回的形式调用VBscript函数

问题描述:

我有点困惑的atm。我(必须......)与传统的asp一起实施一个包含更大的网站。我对语言编码没有影响,所以请不要责怪为languae或结构...经典ASP:在VBScript中返回的形式调用VBscript函数

所以这是我的函数:

function MaintMod2(modcmd) 
if CheckUserRights2("M.Write") or CheckUserRights2("M.Read") then 

response.write("<div class=""formContainer"">"&_ 
    "<form action="">"&_ 
    "<span> CI: <input type=""text"" name=""CI"" value=""byitm6""></span>"&_ 
    "<span> Start: <input type=""text"" name=""Start"" value=""01.03.2013 - 07:30:17""></span>"&_ 
    "<span> End: <input type=""text"" name=""End"" value=""15.04.2013 - 11:37:33""></span>"&_ 
    "<span> Active: <input type=""checkbox"" name=""Active"" value=""Active""></span>"&_ 
    "<input type=""submit"" class=""button"" id=""formSend"">"&_ 
    "</form>"&_ 
"</div>") 
end function 

主要页面(这不是我维护)调用MaintMod2函数来呈现新页面。所以我使用“response.write”来生成我的HTML。

我的问题:我怎样才能从表单动作调用?

<form action="myfunction()"> 

这是我的第一个想法,但它并没有真正的工作:d

+0

防止missunderdandings:'myfunction()'客户端或服务器端函数。我问,因为VBScript可以在客户端和服务器端运行。 – reporter 2013-04-22 12:59:00

+0

应该是服务器端。 Myfunction应该使用表单参数显示数据。 – Leagis 2013-04-22 13:02:26

在我的眼里,我同意call VBScript Sub in a href onclick (classic ASP)

表单动作在客户端启动一个动作。如果可以使用此功能创建指向网站的页面的有效链接。将一个参数添加到URL中,以便您可以识别调用您的方法的操作。在服务器上评估这个参数并执行你的目标方法(类似于MVC方式)。

+0

好的,我得到了我的解决方案: 我使用method =“post”和action =“?Cmd = MaintMod2”。现在我可以使用request.form(“变量”)获取数据... 这个解决方案很糟糕,但它的工作原理是:D – Leagis 2013-04-22 13:44:12

我没有看到你的代码如何工作,因为你的例子在“end function”之前缺少了“end if”的结束语句。所以最后2行应该是...

end if 
end function