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.测试通过

原文地址:https://www.cnblogs.com/pyman/p/1311503.html