use javascript:<script language=javascript>
var win = null;
function OpenOrClose()
{
  if (win == null || win.closed)
    win = window.open("some.aspx","newwin");
  else
  {
    win.close();
    win = null;
  }
}
</script>
<input type=button onclick="OpenOrClose()" value="open/close">

解决方案 »

  1.   

    用   OPEN  方法打开的才可以这样使用
      

  2.   

    刚才测试的时候,怎么窗口b仅仅变成最小化呢?
    参照代码:
     function sShowFooterDialog(intCol)
     {
      var winClose;
    var opt = "";
    var strUrl;

    opt = opt + "location=no";
    opt = opt + ",directories=no";
    opt = opt + ",status=yes";
    opt = opt + ",resizable=yes";
    opt = opt + ",width=640";
    opt = opt + ",height=500";
    opt = opt + ",top=0";
    opt = opt + ",left=0";
    opt = opt + ",menubar=yes";
    opt = opt + ",toolbar=yes";
    opt = opt + ",titlebar=yes";
    opt = opt + ",scrollbars=yes";

    strUrl = "";
    strUrl = strUrl + "IND04_Footer.aspx";
    strUrl = strUrl + "?KKNEN=" + document.Form1.txt計画年.value;
    strUrl = strUrl + "&KKMM=" + document.Form1.txt月.value;
    strUrl = strUrl + "&KKWW=" + document.Form1.txt週.value;
    strUrl = strUrl + "&KKWWED=" + document.Form1.txt週枝番.value;
    strUrl = strUrl + "&COL=" + intCol; 

    winClose = window.open(strUrl,null,opt);

     }
    var winClose = null;
    function OpenOrClose()
    {
      if (winClose == null || winClose.closed)
      {
    //winClose = window.open("some.aspx","newwin");
      }
      else
      {
    winClose.close();
    winClose = null;
      }
    }
      

  3.   

    呵呵,短一点
    if(winID&&winID.open&&!winID.close){
      winID.close()
    }
    if条件用来检查子窗口是否已经关闭!