框架集打开窗口

View Code
window.parent.opener=null;window.parent.close();window.location.href=('Login.aspx')
window.parent: 页面a  下面有框架集  parent 指父窗口:即页面a
1、window.parent一般是在iframe中使用来调用父页面方法或属性
2、window.opener用来指示打开这个窗口的父窗口,也就是调用window.open()来打开本窗口的父窗口,
     就算中间经过了action操作,一个window的opener也不会变。
3、如果window.open()中间经过了action到达本页面,那么它window.parent就是action的路径。
      所以调用window.parent.location.reload()是,刷新的是本页面。
View Code
[<a href="javascript:window.parent.opener=null;window.parent.close();">注销退出</a>]&nbsp;

 protected void Page_Load(object sender, EventArgs e)
    {
        Session["username"] = null;
        Session["username"] = "";
        Page.ClientScript.RegisterStartupScript(this.GetType(),
            "msg", "alert('已安全退出,单击确定返回首页!');window.parent.location.href=('Login.aspx')", true);
    }

 

posted @ 2012-06-25 09:36  ComBat  阅读(164)  评论(0编辑  收藏  举报