[英]Asp.net buttons event click without do postback. Is it possible?
I would like to know if is possible to use a asp:button
, use an event click. 我想知道是否可以使用
asp:button
,使用事件单击。 and call a javascript instead code behind without to do postback? 并在不执行回发的情况下调用JavaScript而不是代码? I need to record voice and I´m using javascript to do this.
我需要录制语音,并且正在使用javascript来做到这一点。 Someone could help me?
有人可以帮我吗?
You could create your button and use the OnClientClick Property in this way: 您可以通过以下方式创建按钮并使用OnClientClick属性:
<asp:Button runat="server" Text="Click me" OnClientClick="myFunction(); return false;" />
With that you call myFunction();
这样就调用了
myFunction();
and the return false;
return false;
prevent the __doPostBack
function will be called avoiding the postback. 防止
__doPostBack
函数被调用以避免回发。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.