2011-12-29 8 views
0

私は以下のように私のホームページ(Default.aspxの)2つのポップアップウィンドウがあります。ParentWindowでPoPupWindowを閉じた後にメッセージを表示する方法(CountDown Timerの中)?

apsxコード:

<div id="OffDiv"> 
</div> 
<div id="TimerContainer"> 
    <asp:Image ID="imgWhiteCircle" runat="server" ImageUrl="~/Images/WhiteCircle.png" /> 
    <asp:Label ID="lblCountDown" runat="server" Text="60" Font-Bold="True" Font-Size="50px" 
     ForeColor="Black"></asp:Label> 
</div> 

CSS:

div#OffDiv 
{ 
    display: none; 
    position: fixed; 
    top: 0px; 
    right: 0px; 
    width: 100%; 
    height: 100%; 
    padding: 0px; 
    margin: 0px; 
    z-index: 90000; 
    background-color: black; 
    filter: alpha(opacity=30); /* internet explorer */ 
    -khtml-opacity: 0.3; /* khtml, old safari */ 
    -moz-opacity: 0.3; /* mozilla, netscape */ 
    opacity: 0.3; /* fx, safari, opera */ 
} 
div#TimerContainer 
{ 
    display: none; 
    position: absolute; 
    width: 110px; 
    height: 110px; 
    top: 200px; 
    left: 50%; 
    margin-left: -55px; 
    padding: 0px; 
    z-index: 90001; 
} 
#imgWhiteCircle 
{ 
    width: 110px; 
} 
#lblCountDown 
{ 
    position: absolute; 
    width: 70px; 
    height: 65px; 
    text-align: center; 
    top: 50%; 
    left: 50%; 
    margin-left: -35px; 
    margin-top: -32.5px; 
} 

JavaScriptのコード:

<script language="javascript" type="text/javascript"> 
     $(function() { 
      var x = screen.availWidth; 
      $('div#OffDiv').css({ 'width': x }); 
      var y = screen.availHeight; 
      $('div#OffDiv').css({ 'height': y }); 

      $('div#OffDiv').css({ 'display': 'block' }); 
      $('div#TimerContainer').css({ 'display': 'block' }); 

      window.open('http://www.MyPoPUp1.com', '_blank', 'channelmode=no,directories=yes,location=no,resizable=yes,titlebar=yes,menubar=no,toolbar=no,scrollbars=yes,status=yes', false); 
      window.open('http://www.MyPoPUp2.com', '_blank', 'channelmode=no,directories=yes,location=no,resizable=yes,titlebar=yes,menubar=no,toolbar=no,scrollbars=yes,status=yes', false); 
      window.focus(); 

      var sec = $('#TimerContainer span').text() 
      var timer = setInterval(function() { 
       $('#TimerContainer span').text(--sec); 
       if (sec == 0) { 
        clearInterval(timer); 
        $('div#OffDiv').css({ 'display': 'none' }); 
        $('div#TimerContainer').css({ 'display': 'none' }); 
       } 
      }, 1000); 
     }); //End Of $(function() 
    </script> 

親ウィンドウにカウントダウンタイマーがあります(60秒から開始)
このタイマーでは、ユーザーにポップアップウィンドウを閉じることを許可したくありません。
どうすればいいですか?


または、ユーザーがポップアップウィンドウの1つを閉じると、親ウィンドウにメッセージを表示するにはどうすればよいですか?
は、ポップアップウィンドウのクローズとその親ウィンドウの間にどのように接続するかを意味しますか?事前

答えて

1

開くポップアップが閉じているかどうか、あなたがフィードバックを得ることができるこの方法で

感謝。

var popup = window.open('http://www.google.com'); 

    var timer = setInterval(function() { 
     if (popup.closed) { 
      alert('popup closed!'); 
      clearInterval(timer); 
     } 
    }, 500); 

よろしく

関連する問題