使用javascript显示消息框,避免像点击事件一样回发。 ok,cancel按钮应该只关闭messgae盒子 [英] displaying message box using javascript by avoiding postback like click events. The ok, cancel buttons should only close the messgae box

查看:107
本文介绍了使用javascript显示消息框,避免像点击事件一样回发。 ok,cancel按钮应该只关闭messgae盒子的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到一种情况,当用户点击页面上的任何按钮或链接按钮时,它应显示消息框。所以我通过addin javascript函数向window.onbeforeunload显示消息框。



直到现在它工作正常。我只是想在用户点击ok或取消按钮而不进行任何回发事件时不显示消息框。所以我保持返回假在确定和取消按钮。当我点击这些确定时,取消按钮它在IE中显示另一个消息框为来自网页的消息错误

i faced a situation when the user clicks on any button or linkbutton on page it should display messagebox. so i am displaying message box by addin javascript function to window.onbeforeunload.

Till now it works fine. i just want not to display the message box when the user clicks on ok or cancel button without doing any postback events. So i kept "return false" on ok and cancel button. When i click on these ok , cancel button its displaying another message box in IE as "Message from web page false"

推荐答案

Try this...

<asp:button runat="server" id="btnDelete" onclick="btnDelete_Click" onclientclick="return confirm('Are you sure to delete?')"/>


这篇关于使用javascript显示消息框,避免像点击事件一样回发。 ok,cancel按钮应该只关闭messgae盒子的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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