|
Trouver une ressource
Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !
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
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... 96 SITES RÉPERTORIÉS : HTML, CSS, DHTML, JAVA, JAVASCRIPT, P...
Sources de la même categorie
Commentaires et avis
|
Comparez les prix Nouvelle version
|