Accueil > > > MANIPULATION DE 4 FENÊTRES POPUP (POSSIBLE)
MANIPULATION DE 4 FENÊTRES POPUP (POSSIBLE)
Information sur la source
Description
4 fonctions permettant d'ouvrir 4 fenêtres. Avec deux noms, soit deux à la fois. La première fonction en paramètrage complet. La 2ème javascript:ow0(url,65,65) pour 65% de l'écran, la 3ème à 75% (2 et 3 en position 5/5) la 4ème à 65% en position centrale. Le tout en fonction de la définition de l'écran. Pour ow0, le choix du pourcentage est supposé être fait pour 1024 et réajusté selon l'affichage du navigateur. Vous pouvez changer les pourcentages et les positions.
Source
- <html>
- <head>
- <script type="text/javascript" language="JavaScript">
- //------------fenetres popup----------------->
- var info1 = null;
- var info2 = null;
- var largfen = screen.width;
- var hautfen = screen.height;
- largfen = largfen * 0.75;
- hautfen = hautfen * 0.75;
- var largfen1 = Math.ceil(largfen * 0.80);
- var hautfen1 = Math.ceil(hautfen * 0.80);
- var posX = (screen.width - largfen1) / 2;
- var posY = (screen.height - hautfen1) / 2;
- function ow(theURL,winName,features)
- {
- if (info2)
- {
- info2.blur();
- }
- if (info1)
- {
- info1.close();
- info1 = window.open(theURL,winName,features);
- info1.focus();
- }
- else
- {
- info1 = window.open(theURL,winName,features);
- info1.focus();
- }
- }
- function ow0(theURL,larg,haut)
- {
- larg = Math.ceil(screen.width * (larg/100)*(1024/screen.width));
- if(larg > screen.width) {larg = Math.ceil(larg*(95/100));}
- haut = Math.ceil(screen.height * (haut/100));
- if (info2)
- {
- info2.blur();
- if (info1)
- {
- info1.close();
- info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ larg +"px,height="+ haut +"px,outerwidth="+ larg +"px,outerheight="+ haut +"px,top=5,left=5,screenX=5,screenY=5");
- info1.focus();
- }
- }
- else {
- if (info1)
- {
- info1.close();
- info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ larg +"px,height="+ haut +"px,outerwidth="+ larg +"px,outerheight="+ haut +"px,top=5,left=5,screenX=5,screenY=5");
- info1.focus();
- }
- else {
- info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ larg +"px,height="+ haut +"px,outerwidth="+ larg +"px,outerheight="+ haut +"px,top=5,left=5,screenX=5,screenY=5");
- info1.focus();
- }
- }
- }
- function ow1(theURL)
- {
- if (info2)
- {
- info2.blur();
- if (info1)
- {
- info1.close();
- info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen +"px,height="+ hautfen +"px,outerwidth="+ largfen +"px,outerheight="+ hautfen +"px,top=5,left=5,screenX=5,screenY=5");
- info1.focus();
- }
- }
- else {
- if (info1)
- {
- info1.close();
- info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen +"px,height="+ hautfen +"px,outerwidth="+ largfen +"px,outerheight="+ hautfen +"px,top=5,left=5,screenX=5,screenY=5");
- info1.focus();
- }
- else
- {
- info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen +"px,height="+ hautfen +"px,outerwidth="+ largfen +"px,outerheight="+ hautfen +"px,top=5,left=5,screenX=5,screenY=5");
- info1.focus();
- }
- }
- }
-
- function ow2(theURL)
- {
- if (info1)
- {
- info1.blur();
- if (info2)
- {
- info2.close();
- info2 = window.open(theURL,"info2","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen1 +"px,height="+ hautfen1 +"px,outerwidth="+ largfen1 +"px,outerheight="+ hautfen1 +"px,top="+ posY +",left="+ posX +",screenX="+ posX +",screenY"+ posY);
- info2.focus();
- }
- else {
- info2 = window.open(theURL,"info2","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen1 +"px,height="+ hautfen1 +"px,outerwidth="+ largfen1 +"px,outerheight="+ hautfen1 +"px,top="+ posY +",left="+ posX +",screenX="+ posX +",screenY"+ posY);
- info2.focus();
- }
- }
- else {
- if (info2)
- {
- info2.close();
- info2 = window.open(theURL,"info2","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen1 +"px,height="+ hautfen1 +"px,outerwidth="+ largfen1 +"px,outerheight="+ hautfen1 +"px,top="+ posY +",left="+ posX +",screenX="+ posX +",screenY="+ posY);
- info2.focus();
- }
- else {
- info2 = window.open(theURL,"info2","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen1 +"px,height="+ hautfen1 +"px,outerwidth="+ largfen1 +"px,outerheight="+ hautfen1 +"px,top="+ posY +",left="+ posX +",screenX="+ posX +",screenY=" +posY);
- info2.focus();
- }
- }
- }
- </script>
- </head>
- <body>
- <p><a href="javascript:ow1('http://www.javascript.com');">Javacript.com</a></p>
- <p><a href="javascript:ow0('http://www.webreference.com',65,65);">webrefence.com</a></p>
- <p><a href="javascript:ow0('http://www.webreference.com/js/',75,85);">Doc Javascript</a></p>
- <p><a href="javascript:ow2('http://www.toutjavascript.com/');">Toutjavascript.com</a></p>
- <p><a href="javascript:ow('http://javascript.internet.com/','info1','scrollbars=yes,resizable=yes,width=700px,height=500px,outerwidth=700px,outerheight=500px,top=80,left=80px,screenX=80px,screenY=80px');">The Javascript Source</a></p>
- </body>
- </html>
<html>
<head>
<script type="text/javascript" language="JavaScript">
//------------fenetres popup----------------->
var info1 = null;
var info2 = null;
var largfen = screen.width;
var hautfen = screen.height;
largfen = largfen * 0.75;
hautfen = hautfen * 0.75;
var largfen1 = Math.ceil(largfen * 0.80);
var hautfen1 = Math.ceil(hautfen * 0.80);
var posX = (screen.width - largfen1) / 2;
var posY = (screen.height - hautfen1) / 2;
function ow(theURL,winName,features)
{
if (info2)
{
info2.blur();
}
if (info1)
{
info1.close();
info1 = window.open(theURL,winName,features);
info1.focus();
}
else
{
info1 = window.open(theURL,winName,features);
info1.focus();
}
}
function ow0(theURL,larg,haut)
{
larg = Math.ceil(screen.width * (larg/100)*(1024/screen.width));
if(larg > screen.width) {larg = Math.ceil(larg*(95/100));}
haut = Math.ceil(screen.height * (haut/100));
if (info2)
{
info2.blur();
if (info1)
{
info1.close();
info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ larg +"px,height="+ haut +"px,outerwidth="+ larg +"px,outerheight="+ haut +"px,top=5,left=5,screenX=5,screenY=5");
info1.focus();
}
}
else {
if (info1)
{
info1.close();
info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ larg +"px,height="+ haut +"px,outerwidth="+ larg +"px,outerheight="+ haut +"px,top=5,left=5,screenX=5,screenY=5");
info1.focus();
}
else {
info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ larg +"px,height="+ haut +"px,outerwidth="+ larg +"px,outerheight="+ haut +"px,top=5,left=5,screenX=5,screenY=5");
info1.focus();
}
}
}
function ow1(theURL)
{
if (info2)
{
info2.blur();
if (info1)
{
info1.close();
info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen +"px,height="+ hautfen +"px,outerwidth="+ largfen +"px,outerheight="+ hautfen +"px,top=5,left=5,screenX=5,screenY=5");
info1.focus();
}
}
else {
if (info1)
{
info1.close();
info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen +"px,height="+ hautfen +"px,outerwidth="+ largfen +"px,outerheight="+ hautfen +"px,top=5,left=5,screenX=5,screenY=5");
info1.focus();
}
else
{
info1 = window.open(theURL,"info1","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen +"px,height="+ hautfen +"px,outerwidth="+ largfen +"px,outerheight="+ hautfen +"px,top=5,left=5,screenX=5,screenY=5");
info1.focus();
}
}
}
function ow2(theURL)
{
if (info1)
{
info1.blur();
if (info2)
{
info2.close();
info2 = window.open(theURL,"info2","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen1 +"px,height="+ hautfen1 +"px,outerwidth="+ largfen1 +"px,outerheight="+ hautfen1 +"px,top="+ posY +",left="+ posX +",screenX="+ posX +",screenY"+ posY);
info2.focus();
}
else {
info2 = window.open(theURL,"info2","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen1 +"px,height="+ hautfen1 +"px,outerwidth="+ largfen1 +"px,outerheight="+ hautfen1 +"px,top="+ posY +",left="+ posX +",screenX="+ posX +",screenY"+ posY);
info2.focus();
}
}
else {
if (info2)
{
info2.close();
info2 = window.open(theURL,"info2","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen1 +"px,height="+ hautfen1 +"px,outerwidth="+ largfen1 +"px,outerheight="+ hautfen1 +"px,top="+ posY +",left="+ posX +",screenX="+ posX +",screenY="+ posY);
info2.focus();
}
else {
info2 = window.open(theURL,"info2","scrollbars=yes,menubar=yes,resizable=yes,width="+ largfen1 +"px,height="+ hautfen1 +"px,outerwidth="+ largfen1 +"px,outerheight="+ hautfen1 +"px,top="+ posY +",left="+ posX +",screenX="+ posX +",screenY=" +posY);
info2.focus();
}
}
}
</script>
</head>
<body>
<p><a href="javascript:ow1('http://www.javascript.com');">Javacript.com</a></p>
<p><a href="javascript:ow0('http://www.webreference.com',65,65);">webrefence.com</a></p>
<p><a href="javascript:ow0('http://www.webreference.com/js/',75,85);">Doc Javascript</a></p>
<p><a href="javascript:ow2('http://www.toutjavascript.com/');">Toutjavascript.com</a></p>
<p><a href="javascript:ow('http://javascript.internet.com/','info1','scrollbars=yes,resizable=yes,width=700px,height=500px,outerwidth=700px,outerheight=500px,top=80,left=80px,screenX=80px,screenY=80px');">The Javascript Source</a></p>
</body>
</html>
Conclusion
Les fenêtres sont systèmatiquement fermées avant d'êtres ouvertes afin de pouvoir être redimensionnées. J'ai ajouté un exemple pour que ce soit plus clair. Je signale qu'en passant la deuxième fenêtre en blur, des perturbations peuvent intervenir si on envoie à répétition sur des sites où plusieurs fenêtres s'ouvrent. (le nav indique que le serveur n'est plus disponible, mais peut-être cela n'est dû qu'à l'essai en local du script)
Sources du même auteur
DHTML - MANIP CSSDHTML - MANIP CSS Beaucoup de façons de changer une page en manipulations dhtml et css, en inner et outer Text/HTML.
Des choses intéressantes.
Certaines peuvent paraî...
OUVERTURE POPUP À URL ALÉATOIREOUVERTURE POPUP À URL ALÉATOIRE Ouverture ici automatique au chargement de la page.
Aléatoire parmi une liste d'URL définis en Array.
Popup positionnée et dimensionnée, selon scree...
96 SITES RÉPERTORIÉS : HTML, CSS, DHTML, JAVA, JAVASCRIPT, P...96 SITES RÉPERTORIÉS : HTML, CSS, DHTML, JAVA, JAVASCRIPT, PHP-CGI Page où sont répertoriés 96 sites internet pour webmasters, javascript, css, dhtml, php-cgi, java et autres. En français et anglais (souvent)
+ fonct...
BROWSER SNIFFER (RENIFLEUR)BROWSER SNIFFER (RENIFLEUR) Script qui n'est pas de moi, en exemple, extrait de <http://www.webreference.com/js>, et qui donne trop d'informations et comporte trop de liens vers ...
DHTML SCROLLTOPDHTML SCROLLTOP Présentez sur écran!
Suite du scroll au top mais assez suffisemment avancée pour être mise seule.
Toujours un menu mascable/affichable par clic sur ...
Sources de la même categorie
Commentaires et avis
|
Derniers Blogs
XNA IS DEAD!XNA IS DEAD! par richardc
Depuis la semaine dernière (et grâce aux TechDays 2012), je me penche activement sur la nouvelle version de Windows, aka Windows 8. Vous me direz, il était temps puisque la première preview date de Septembre dernier.
OK. Remarquez, on n'en est qu'aux...
Cliquez pour lire la suite de l'article par richardc TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 !TECHDAYS PARIS 2012 : WINDOWS SERVER "8" QUOI DE 9 ! par ROMELARD Fabrice
Speakers: Fabrice Meillon et Stanislas Quastana Cette session est basée entièrement sur celle donnée lors de la BUILD cet hiver. Il n'y a pas d'ajout d'information en rapport avec cet évènement passé. Windows 8 Server sera intégralem...
Cliquez pour lire la suite de l'article par ROMELARD Fabrice [HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE)[HTML5] AUTOUR DU W3C : NOUVEAUX STANDARDS ET WEB MOBILE (LILLE) par Gio
Je m'y prends un peu tard je sais, mais bon je suis développeur web et donc hyper fainéant ! Toujours dans le cadre des technologies émergentes, ici HTML5, parce qu'on aime HTML5 chez Wyg , nous seront présent, le vieux ( Aurélien V.) et moi, pour pr...
Cliquez pour lire la suite de l'article par Gio [WP7] DYNAMICALLY CHANGE STARTUP PAGE[WP7] DYNAMICALLY CHANGE STARTUP PAGE par KooKiz
Let's say that you want to allow the user to customize the startup page of your application. You can easily change the startup page by editing the 'NavigationPage' attribute in the manifest file. But the manifest cannot be modified once the applicatio...
Cliquez pour lire la suite de l'article par KooKiz
Logiciels
DocTranslate (V3.1.0.0)DOCTRANSLATE (V3.1.0.0)DocTranslate est un traducteur de document Microsoft Word, PowerPoint et Excel. Il permet d'autom... Cliquez pour télécharger DocTranslate Tribler (2012)TRIBLER (2012)Tribler est un client pair à pair (P2P/Peer-to-Peer) open source avec la capacité de regarder des... Cliquez pour télécharger Tribler OneSwarm (2012)ONESWARM (2012)Le peer-to-peer qui protège votre vie privée, c'est OneSwarm.
Ce logiciel de peer-to-peer crypté... Cliquez pour télécharger OneSwarm PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO (V8.4)PONAMEDIA TV DEVIENS HELLLOOO FLASH
LA TV SUR VOTRE ORDINATEUR.
Toute une plateforme Multi... Cliquez pour télécharger PONAMEDIA PREMIUM - HELLLOOO FLASH DEMO Academy System (17.2.1.0)ACADEMY SYSTEM (17.2.1.0)Logiciel de gestion des établissements.
- élèves/étudiants (inscription, dossier, absence...)
-... Cliquez pour télécharger Academy System
|