核心ASP,vbScript按钮单击事件不起作用 [英] Core ASP, vbScript Button click event not working
本文介绍了核心ASP,vbScript按钮单击事件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好专家! :)
这是我的asp页面
按钮点击我想调用vbscript函数但不工作
我试过很多谷歌的结果搜索,但他们没有工作:(
< html >
< head >
<%
sub TestOnClick()
response.write < script> alert(1);< / script>
end sub
%>
< / head >
< 正文 >
< 表格 name = form >
<%
回复.write < script> alert(1);< / script>
%>
< 输入 type =' 按钮' id =' btn' value =' 点击' onclick =' <% TestOnClick()%> ' / >
< / form >
< / body >
< / html >
请帮忙解决它
解决方案
你正在写ASP指标内的vbscript。更改您的< %%> to< script type =text / vbscript>< / script>或者使用经典的ASP。
为什么你不能这样尝试......?
< script runat = server>
受保护的子Button1_Click(ByVal sender As Object,ByVal e As System.EventArgs)
Response.Write( hi)
结束次级
< / script>
< div >
< asp:button id = Button1 runat = server onclick = Button1_Click text = 按钮 xmlns:asp = #unknown / >
< / div >
希望这会对你有帮助..
< blockquote>我从网站获得解决方案,
从页面调用服务器端方法是不可能的,例如核心Asp中的点击事件
所以,我创建了一个页面并列出了所有任务,然后使用Javascript XttpPageRequest
希望,它会帮助那些面临同样问题的人。
快乐编码!
:)
Hello Experts! :)
this is my asp page
on button click I want to call vbscript function but not working
I have tried many results from google search but they didn''t worked :(
<html>
<head>
<%
sub TestOnClick()
response.write "<script>alert(1);</script>"
end sub
%>
</head>
<body>
<form name="form" >
<%
response.write "<script>alert(1);</script>"
%>
<Input type='button' id='btn' value='click' onclick='<%TestOnClick()%>' />
</form>
</body>
</html>
please help to solve it
解决方案
You are writing vbscript inside ASP indicators. Change your <% %> to <script type="text/vbscript"></script> or use classic ASP instead.
Why can''t you try like this...?
<script runat="server"> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Response.Write("hi") End Sub </script>
<div> <asp:button id="Button1" runat="server" onclick="Button1_Click" text="Button" xmlns:asp="#unknown" /> </div>
Hope this will help you..
I got solution from a site,
It''s not possible to call server-side method from page e.g. on-click event in core Asp
so, that I have create a page and list there all tasks and then call that page using Javascript XttpPageRequest
Hope, it will help them who are facing same problem.
Happy Coding!
:)
这篇关于核心ASP,vbScript按钮单击事件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文