zoukankan      html  css  js  c++  java
  • web与flash结合:不出现提示,直接关闭窗口(javascript)+直接关闭,不提示

    情况是:web页中插入了swf文件,不出现提示,直接关闭窗口,我找了很多命令,也没有研究出来

    //fscommand("quit");
      //getURL("javascript:window.close()");
     //getURL("self.close()");

    后来看了网上例子如下:
    <script type="text/javascript">
    function cl()
    {
    window.opener=null;
    window.open("",'_self',""); //新加了一句
    window.close();
    }
    </script>
    </head>
    <body>
    <input type="button" onclick="cl()" value="close">
    </body>

    以上是onclick调用了函数cl();

    所以我可以在插入的swf中的一个按钮中加入代码调用函数

    on (release) {
     getURL(http://www.163.com/, "_blank");
     getURL("javascript:window.cl()");

    }

    结合后就可以实现如题了。测试在ie6/7均获得成功。

    如果想c#中关闭当前窗口,则

     protected void Page_Load(object sender, EventArgs e)
        {
             Button1.Attributes.Add("onclick", "return confirm('你确认关闭么?'); ");//这句有关闭提示的,也可以不要

    }

    protected void Button1_Click(object sender, EventArgs e)
        {
             Response.Write("<script language=javascript>document.form1.target='webform1';</script>");
            Response.Write("<script language=javascript>window.opener=null;self.close(this);  </script>");

        }

    就这么简单。ok.测试通过

  • 相关阅读:
    【转】运行维护管理制度
    系统负载超预警 问题定位
    19-多进程学习
    3-Pandas层次化索引&拼接
    2-Anaconda简介&Numpy基础
    1-IPython&jupyter notebook
    18-进程&协程
    17-多线程
    16-网络通信
    15-正则表达式
  • 原文地址:https://www.cnblogs.com/pyman/p/1311503.html
Copyright © 2011-2022 走看看