gpt4 book ai didi

c# - ASP :button and javascript popup

转载 作者:行者123 更新时间:2023-11-29 20:07:10 26 4
gpt4 key购买 nike

我想添加一个简单的确认,当您单击执行回发的 asp:button 时,您确定会出现对话框吗?像这样的东西:

OnClientClick="if(confirm('Format the hard disk?'))
alert('something');
else alert('something else')"

问题是,无论您单击确定还是取消,它仍然会回发。如何让它只在 OK 时回发?

最佳答案

如果您只是想根据确认对话框中的选择进行回发,这可能更简单:

OnClientClick="return confirm('Are you sure?');"

关于c# - ASP :button and javascript popup,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11543139/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com