使用html onclick,ASP调用VBScript子例程/函数 [英] Calling a VBScript subroutine/function using html onclick, ASP

查看:255
本文介绍了使用html onclick,ASP调用VBScript子例程/函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<%@ language = "VBScript"%>
<!DOCTYPE html>
<html>
<body> 

<form method="post" action = "">
<input type = "submit" onclick = "check()" value = "Submit"/>
</form> 

<%
sub check()
    Response.write("TEST")  
end sub
%>

</body>
</html>

当我单击提交"按钮时,由于某种原因,它不会打印"TEST".

When I click on the submit button, this doesn't print "TEST" for some reason.

推荐答案

经典ASP在服务器上运行.点击事件在客户端上发生.两者之间没有持久的联系. Web编程与桌面应用程序编程不同.

Classic ASP runs on the server. Click events happen on the client. There is no persistent connection between the two. Web programming is not the same as desktop app programming.

从根本上讲,您的代码需要遵循以下模式:

At a basic level, your code needs to follow this pattern:

浏览器-单击->请求服务器->服务器处理请求->服务新页面->浏览器

BROWSER - click -> request to server -> server processes request -> serves new page -> BROWSER

这篇关于使用html onclick,ASP调用VBScript子例程/函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆