Creer un popup qui s'ouvre automatiquement

Fermé
gege62530 - 20 juil. 2011 à 20:44
adns Messages postés 1094 Date d'inscription vendredi 23 février 2007 Statut Membre Dernière intervention 27 mars 2012 - 22 juil. 2011 à 22:07
Bonjour,

J'ai fait ce script pour ouvrir un popup mais la il est en lien et je voudrais qu'il s'ouvre automatiquement

Voila le code :

<a href="avertissement.php" onclick="window.open( 'avertissement.php', 'Avertissement', 'height=125, width=325, top=100, left=100, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=no, status=no', 'this.href'); return false;">Popup</a>


Merci bien =)

A voir également:

1 réponse

adns Messages postés 1094 Date d'inscription vendredi 23 février 2007 Statut Membre Dernière intervention 27 mars 2012 153
21 juil. 2011 à 09:17
Bonjour,

pour qu'un script se lance automatiquement il te faut utilise l'événement onload.

Exemple

window.onload = window.open( 'avertissement.php', 'Avertissement', 'height=125, width=325, top=100, left=100, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=no, status=no', 'this.href');


Adns
1
Merci bien mais quand je copie ton code dans ma page j'ai juste le script qui s'affiche sur ma page mais il n'a aucun effet =/
0
adns Messages postés 1094 Date d'inscription vendredi 23 février 2007 Statut Membre Dernière intervention 27 mars 2012 153
22 juil. 2011 à 08:24
il s'agit un morceau de code JavaScript il faut donc le placer dans des balises <script></script>

Adns
0
Ah daccord mais cela ne marche toujours pas...

<script window.onload = window.open( 'avertissement.php', 'Avertissement', 'height=125, width=325, top=100, left=100, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=no, status=no', 'this.href');></script> 
0
adns Messages postés 1094 Date d'inscription vendredi 23 février 2007 Statut Membre Dernière intervention 27 mars 2012 153
22 juil. 2011 à 15:32
<script> window.onload = window.open( 'avertissement.php', 'Avertissement', 'height=125, width=325, top=100, left=100, toolbar=no, menubar=no, location=no, resizable=yes, scrollbars=no, status=no', 'this.href');
</script> 
0
Oups merci ^^
0