如何使用javascript在Web浏览器控件框中使用关闭事件 [英] how to use closing event in web browser control box using javascript

查看:64
本文介绍了如何使用javascript在Web浏览器控件框中使用关闭事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我在VS2008上使用Asp.net。

我需要使用java在浏览器控制框中关闭事件脚本。(例如最小化,最大化或关闭)。

可以在网络浏览器中找到控制盒的结束事件。



请求给我建议或想法..



问候

Mukesh

Hi All,

I am using Asp.net with VS2008.
I need to closing event in browser control box using java script.(such as minimize,maximize or close).
is this possible to find closing event for control box in web browser.

pleas give me suggestion or idea ..

Regards
Mukesh

推荐答案

此链接可能对您有所帮助

http://forums.asp.net/ t / 1832024.aspx / 1 [ ^ ]
This link may be helpful to you
http://forums.asp.net/t/1832024.aspx/1[^]


有一个非标准的onbeforeunload函数可用于检测用户是否离开页面。它几乎适用于除Opera以外的所有浏览器(严格遵循W3C标准)。此功能的问题在于,当点击任何外部链接或提交表单时,它也会使用户烦恼。您可以使用jQuery并进行一些代码调整以避免它。请尝试以下示例:



There is a non-standard onbeforeunload function you can use to detect if the user is leaving the page. It works in almost all the browsers except Opera (it follows W3C standards strictly). The problem with this function is that it will also annoy users when any external link is clicked or the form is submitted. You may use jQuery and do some code-tweaking to avoid it. Try following example:

<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.8.3.min.js" type="text/javascript"></script>
    <script language="javascript" type="text/javascript">
        window.onbeforeunload = function () {
            return "Are you sure you want to leave this page?";
        };


document )。ready( function (){
(document).ready(function () {


这篇关于如何使用javascript在Web浏览器控件框中使用关闭事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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