比如:有一个页面放一个gridview控件显示列表,点击标题列可以弹出新页面,查看这条记录的"祥细信息",怎么能实现点击"祥细信息"页面上的关闭按钮,实现关闭当前页面,并且可以刷新列表页面的效果?

解决方案 »

  1.   

    <script language="javascript"> 
              function closewin() 
              { 
                 if(event.clientX>document.body.clientWidth&&event.clientY<0||event.altKey) //检测窗口关闭事件 
                 { 
                     self.close(); 
                     window.opener.location.href=Form1.Hidden1.value;   //不能用window.opener.location.reload(),否则会出提示框 
                 } 
              } 
    </script> <body bgColor="darkgray" MS_POSITIONING="GridLayout" onbeforeunload="closewin()";>
      

  2.   

    直接写
    window.opener.location.reload();   
    window.close();
      

  3.   

    qmu0528,我试了,<input type="button" value="but" id="but_close" onclick="closewin()"/>
    这样不行呢,根本不执行,如果把if诗句注释了,可以关闭,但是有提示出来
      

  4.   

    另外再请教大家一个问题,点“删除”按钮,弹出提示对话框,根据选择的“确定/取消”,选择是否删除,如何实现?现在删除的函数写了deletefile(),
      

  5.   

    假设A.aspx为父窗口,B.aspx为window.open()的方式打开的子窗口,在子窗口中更改数据,要求在父窗口中的列表里更新。
    //在B.aspx的提交按钮中添加如下代码,效果为刷新父窗口,关闭子窗口。
    Response.Write("<script>window.opener.__doPostBack('','');top.opener =null;top.close();</script>");
      

  6.   

    在a窗口放置一个很小的按钮btnGetCurRecord,1*1就行了,在按钮上定义刷新事件,然后
    Response.Write("<script>self.opener.document.Form1.btnGetCurRecord.click();</script>");
    Response.Write("<script>window.close();</script>");
      

  7.   

    window.opener.location.replace(window.opener.location.href)
     or
    window.opener.location.replace("要刷新的页面")
      

  8.   

    window.opener.location.href += "";
    window.close();
      

  9.   

    return confirm('是否删除?');