如何通过使用click事件从按钮(在html中)调用子过程? [英] How to call a sub procedure from the button(in html) by using on click event ?

查看:110
本文介绍了如何通过使用click事件从按钮(在html中)调用子过程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我单击显示"按钮时,它没有在表中显示"a"(在asp子过程中给出)的值.
我希望当我单击显示"按钮时,必须在表中显示asp中给出的"a"值.

When I click on the "show" button, it is not displaying the value of "a"(given in asp sub procedure)in the table.
I want that when I click on the "show" button then the value of "a" given in asp must be displayed in the table.

<html>
<head>
<title>Opinion Poll
</title>
</head>
<body>
<h1 align=center>Opinion Poll</h1><br>
Exam should be conduct for each class :
<form method=post name=frm>
YES<input type=radio name=poll value="1">
NO<input type=radio name=poll value="2">
CAN'T SAY<input type=radio name=poll value="3">
<br>
<input type=submit value=SUBMIT name=sub>
<%
set counter1=server.createobject("mswc.counters")
%>
<%
dim op
op=request.form("poll")
if(op="1")then
counter1.increment("y")
elseif(op="2")then
counter1.increment("n")
elseif(op="3")then
counter1.increment("c")
end if
%>
<table border=1 align=center>
<caption>VOTER'S TALLY</caption>
<tr><td>yes<td>
<%
sub on_event()
a=counter1.get("y")
response.write a
end sub
%>

<tr><td>no<td>
<%
=counter1.get("n") %>

<tr><td>can't say<td>
<%
=counter1.get("c") %>

</table>
<br>
<center><input type=reset value=clear>&nbsp;&nbsp
<input type=button value=show onclick="<% on_event() %>">
</center>
</form>
</body>
</html>

推荐答案

如果这是经典的ASP代码,则无法调用服务器端方法.您需要提交表单,然后根据条件显示数据.
If this is classic asp code then you cannot call a server side method. you need to submit the form and then display the data based on the condition.


这篇关于如何通过使用click事件从按钮(在html中)调用子过程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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