var win = open('test.htm','abc');function a(){
  s = win.location.href;
  p = s.lastIndexOf("/");
  pe = s.indexOf("?");
  if(pe == -1) pe = s.length;
  s = s.substring(p+1,pe);
  if(s =="test.htm"){ alert("yes") }
}

解决方案 »

  1.   

    不是这样的 啊
     子窗口是表单提交打开的:<form method=post action="te.asp" target=abc>
    te.asp在打开后一段时间跳转到test.htm
    判断这个abc窗口的url是否跳转到了test.htm
      

  2.   

    如果时通过open方法打开的话
    通过location.href可以获得
    var win = window.open("some.htm", "_blank", "width=203,height=202");
     alert(win.location.href);
      

  3.   

    <script>
    var win;
    function a(){
      var s = win.location.href;
      p = s.lastIndexOf("/");
      pe = s.indexOf("?");
      if(pe == -1) pe = s.length;
      s = s.substring(p+1,pe);
      if(s =="test.htm"){ alert("yes") }
    }
    function b(){
     win=open('about:blank','abc');
     while(!win){;}
     document.form_name.submit();
    }
    </script>
    <form action="test.asp" target="abc" name="form_name">
    <input type="button" onclick="b();" value="submit"><input type="button" value="check" onclick="a()">
    </form>
    在test.htm回调父窗口的函数更简单<body onload="opener.xxx()">。
      

  4.   

    <html>
    <body>
    <a href="test2.htm" target="abc">test2.htm</a>
    <input type=button value=test onclick="testFun();" ></body>
    <script> 
    function testFun()
    {
    window.open("javascript:if( (/test2\.htm/ig).test(window.location)) top.close(); else alert('???&#1194;?&#1585;&#1383;);","abc")
    }
    </script>
    </html>
      

  5.   

    <html>
    <body>
    <a href="test2.htm" target="abc">test2.htm</a>
    <input type=button value=test onclick="testFun();" ></body>
    <script> 
    function testFun()
    {
    window.open("javascript:if( (/test2\.htm/ig).test(window.location)) top.close(); else alert('Window will not be colsed.');","abc")
    }
    </script>
    </html>