Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道是否可以使用asp:button, 使用事件点击。并在不回发的情况下调用javascript而不是代码?我需要录制声音,我正在使用 javascript 来执行此操作。有人可以帮助我吗?
asp:button
您可以通过以下方式创建按钮并使用 OnClientClick 属性:
<asp:Button runat="server" Text="Click me" OnClientClick="myFunction(); return false;" />
有了这个你调用myFunction();和return false;防止__doPostBack函数将被调用避免回发。
myFunction();
return false;
__doPostBack