Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [JS] Verifica dal padre se popup è aperta

    Ciao,
    come posso verificare dalla pagina che apre una popup se quest'ultima è già aperta?
    Ciao, Matteo.

  2. #2
    Utente di HTML.it L'avatar di badaze
    Registrato dal
    Jun 2002
    residenza
    Lyon
    Messaggi
    5,361
    Puoi fare cosi.

    File principale.
    codice:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    
    <html>
    <head>
    <title>Untitled</title>
    <script language="JavaScript" type="text/javascript">
    <!--
    var aMyPopup = null;
    
    function popUp() {
     wnd_parms2 = "height=500, width=700, menubar=no, toolbar=no,resizable=no,scrollbars=yes";
     aMyPopup   = window.open("test3001b.html","pop_up",wnd_parms2);
    }
    
    function isPopUpOpened() {
     if (aMyPopup == null) {
      return false;
     }
     
     if (aMyPopup.closed) {
      return false;
     }
     
     return true;
    }
    //-->
    </script>
    
    </head>
    <body>
    <input type="button" value="Opens popup" onclick="popUp()">
    
    
    <input type="button" value="Test popup"  onclick="alert(isPopUpOpened())">
    
    </body>
    </html>
    File test3001b.html
    codice:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    
    <html>
    <head>
    <title>Untitled</title>
    </head>
    <body>
    Pop UP
    </body>
    </html>

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.