如何动态删除window.onbeforeunload [英] how to remove window.onbeforeunload on the fly

查看:53
本文介绍了如何动态删除window.onbeforeunload的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在带有向导控件的asp.net页面中,我使用

 窗口 .onbeforeunload  pre>.

此代码可防止使用退格代码的人使向导意外.
在最后一步

(StepType = " )

我要删除该功能.

解决方案

最终很简单:

Page.ClientScript.RegisterStartupScript(Page.GetType(), "cancelOnBefore", " window.onbeforeunload = null;", true);


In am asp.net page with a wizard control I have a part of javascript with the use of

window.onbeforeunload

.

This code prevents that people that use the backspace code leave the wizard unexpected.
In that last step

(StepType="Complete")

I want the function removed. How to do this?

解决方案

in the end it was pretty simple:

Page.ClientScript.RegisterStartupScript(Page.GetType(), "cancelOnBefore", " window.onbeforeunload = null;", true);


这篇关于如何动态删除window.onbeforeunload的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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