IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

POPUP : tester si la popup est déjà ouverte...


Sujet :

JavaScript

  1. #1
    Membre à l'essai
    Inscrit en
    Juillet 2004
    Messages
    30
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 30
    Points : 19
    Points
    19
    Par défaut POPUP : tester si la popup est déjà ouverte...
    Bonjour à tous

    Voici mon problème :

    Je dois bidouiller un script actuel afin de tester si la popup est déjà ouverte ou pas.
    - Au bout de 3 secondes la popup s'ouvre en fullscreen (contien du flash).
    - Si l'internaute clique sur le logo avant les 3 secondes, la popup s'ouvre. Mais le flash "se recharge"... C'est à dire que la fonction déclenchant la popup au bout des 3 secondes s'éxécute quand même...

    J'ai essayé d'utiliser une fonction testant si la popup est ouverte ou non mais sans succès...

    Qu'est-ce qui cloche ?
    D'avance merci

    Voici le code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
     
    <HTML>
    <HEAD>
    	<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=iso-8859-1">
    	<META NAME="Author" CONTENT="">
    	<META NAME="description" CONTENT="">
    	<META NAME="keywords" CONTENT="">
    	<TITLE>Grand Voyageur</TITLE>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function fullscreen(Ie,other){
    x=screen.availWidth;
    y=screen.availHeight;
     
    target = parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf('.')-1,navigator.appVersion.length));
    if((navigator.appVersion.indexOf("Mac")!=-1)) {
    	window.open(other,"sub",'scrollbars=no');
    } 
    else {
    	if (target >= 4){
    		if (navigator.appName=="Netscape"){
    		var fullscreen=window.open(other,"fullscreen",'scrollbars=no','width='+x+',height='+y+',top=0,left=0');
    		fullscreen.moveTo(0,0);
    		fullscreen.resizeTo(x,y);
    	}
    	if (navigator.appName=="Microsoft Internet Explorer")
    		window.open(Ie,"fullscreen","fullscreen=yes");
    		}
    			else window.open(other,"sub",'scrollbars=yes');
    		}
    }
     
    function bolo()
    {
    	setTimeout("fullscreen('popup.htm','popup.htm')", 3000);
    }
     
    /*function TestFenetre() { 
        if(fullscreen.closed == false) {
            // la fenetre est ouverte
        }
        else{
    		// la fenetre est fermer
            fullscreen('popup.htm','popup.htm');
        }
    } */
    //-->
    </script>
    <style>
    a.Lien:active {font-family: Arial, sans-serif;font-size:11px; color: #6C6C6C;  text-decoration:  none }
    a.Lien:link {font-family: Arial, sans-serif;font-size:11px; color: #6C6C6C; text-decoration: none }
    a.Lien:visited {font-family: Arial, sans-serif;font-size:11px; color: #6C6C6C; text-decoration: none }
    a.Lien:hover {font-family: Arial, sans-serif;font-size:11px; color: #6C6C6C; text-decoration:  none;}
    </style>
    </HEAD>
     
    <BODY BGCOLOR="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0" BOTTOMMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0" RIGHTMARGIN="0" onload="bolo();">
    <TABLE WIDTH="100%" HEIGHT="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="center">
    <TR>
    	<TD ALIGN="center"><!-- <A HREF="javascript:TestFenetre();"><IMG SRC="img/logo.gif" BORDER="0"></A> --><A HREF="#" ONCLICK="fullscreen('popup.htm','popup.htm');"><IMG SRC="img/logo.gif" BORDER="0"></A></TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    90
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 90
    Points : 100
    Points
    100
    Par défaut
    Crée une variable globale (en dehors de toute fonction) qui représente la popup. Par exple "var popup=new window;".

    Change de nom pour la popup... tu as une variable "fullscreen" et une fonction "fullscreen"... je trouve ça génant.

    A chaque fois que tu fais un window.open, mets bien popup=window.open(...).

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    <script language="JavaScript" type="text/JavaScript"> 
    <!-- 
    var popup=new window;
    function fullscreen(Ie,other){ 
    x=screen.availWidth; 
    y=screen.availHeight; 
     
    target = parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf('.')-1,navigator.appVersion.length)); 
    if((navigator.appVersion.indexOf("Mac")!=-1)) { 
       popup=window.open(other,"sub",'scrollbars=no'); 
    } 
    else { 
       if (target >= 4){ 
          if (navigator.appName=="Netscape"){ 
          popup=window.open(other,"popup",'scrollbars=no','width='+x+',height='+y+',top=0,left=0'); 
          popup.moveTo(0,0); 
          popup.resizeTo(x,y); 
       } 
       if (navigator.appName=="Microsoft Internet Explorer") 
          popup=window.open(Ie,"popup","fullscreen=yes"); 
          } 
             else popup=window.open(other,"sub",'scrollbars=yes'); 
       } 
    } 
     
    function bolo() 
    { 
       setTimeout("fullscreen('popup.htm','popup.htm')", 3000); 
    } 
     
    function TestFenetre() { 
        if(popup.closed == false) { 
            // la fenetre est ouverte
    	alert('ok'); 
        } 
        else{ 
          // la fenetre est fermer 
            fullscreen('popup.htm','popup.htm'); 
        } 
    } 
    //--> 
    </script>

  3. #3
    Membre à l'essai
    Inscrit en
    Juillet 2004
    Messages
    30
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 30
    Points : 19
    Points
    19
    Par défaut
    Merci pour ton aide
    Mais il y a une erreur ligne 12...

  4. #4
    Membre régulier
    Profil pro
    Inscrit en
    Avril 2005
    Messages
    90
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2005
    Messages : 90
    Points : 100
    Points
    100
    Par défaut
    vire le "=new window"

  5. #5
    Membre à l'essai
    Inscrit en
    Juillet 2004
    Messages
    30
    Détails du profil
    Informations forums :
    Inscription : Juillet 2004
    Messages : 30
    Points : 19
    Points
    19
    Par défaut
    Merci pour votre aide... Mais entre temps je suis reparti de 0...

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
     
    <HTML>
    <HEAD>
    	<META HTTP-EQUIV="content-type" CONTENT="text/html;charset=iso-8859-1">
    	<META NAME="Author" CONTENT="">
    	<META NAME="description" CONTENT="">
    	<META NAME="keywords" CONTENT="">
    	<TITLE></TITLE>
    <script language="javascript">
    <!--
    tempo = false;
     
    function pleinecran(toto)
    {  
    	if (tempo) clearTimeout(tempo);
    	nw=window.open('popup.htm','toto','width='+screen.width+',height='+screen.height+',fullscreen=yes,scrollbars=no,top=0,left=0');  
    } 
     
    function TestFenetre() { 
    	tempo = setTimeout("pleinecran()", 3000);
    }
    //-->
    </script>
    <style>
    a.Lien:active {font-family: Arial, sans-serif;font-size:11px; color: #6C6C6C;  text-decoration:  none }
    a.Lien:link {font-family: Arial, sans-serif;font-size:11px; color: #6C6C6C; text-decoration: none }
    a.Lien:visited {font-family: Arial, sans-serif;font-size:11px; color: #6C6C6C; text-decoration: none }
    a.Lien:hover {font-family: Arial, sans-serif;font-size:11px; color: #6C6C6C; text-decoration:  none;}
    </style>
    </HEAD> 
     
    <BODY BGCOLOR="#FFFFFF" TOPMARGIN="0" LEFTMARGIN="0" BOTTOMMARGIN="0" MARGINHEIGHT="0" MARGINWIDTH="0" RIGHTMARGIN="0" onload="TestFenetre();">
    <TABLE WIDTH="100%" HEIGHT="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0" ALIGN="center">
    <TR>
    	<TD ALIGN="center"><A HREF="#" ONCLICK="javascript:pleinecran();"><IMG SRC="img/logo.gif" BORDER="0"></A></TD>
    </TR>
    </TABLE>
    </BODY>
    </HTML>

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. [VBA-E] comment tester si un fichier est déjà ouvert?
    Par DonKnacki dans le forum Macros et VBA Excel
    Réponses: 35
    Dernier message: 25/01/2016, 10h34
  2. [À télécharger] Tester si un fichier est déjà ouvert
    Par SfJ5Rpw8 dans le forum Vos téléchargements VB6
    Réponses: 1
    Dernier message: 16/08/2013, 01h24
  3. Réponses: 3
    Dernier message: 13/12/2012, 00h21
  4. Tester si un fichier est déjà ouvert par un programme tiers
    Par E@gle_One dans le forum Entrée/Sortie
    Réponses: 16
    Dernier message: 17/04/2008, 11h33
  5. tester si un fichier est déjà ouvert
    Par fredppp dans le forum VC++ .NET
    Réponses: 1
    Dernier message: 21/05/2007, 13h29

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo