begin process at 2010 03 22 13:05:07
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Fenêtre & Pop-up

 > MANIPULATION DE 4 FENÊTRES POPUP (POSSIBLE)

MANIPULATION DE 4 FENÊTRES POPUP (POSSIBLE)


 Information sur la source

Note :
Aucune note
Catégorie :Fenêtre & Pop-up Niveau :Initié Date de création :03/12/2002 Date de mise à jour :06/12/2002 09:56:46 Vu :7 642

Auteur : Deny

Ecrire un message privé
Commentaire sur cette source (2)
Ajouter un commentaire et/ou une note

 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 CSS
OUVERTURE POPUP À URL ALÉATOIRE
Source avec Zip 96 SITES RÉPERTORIÉS : HTML, CSS, DHTML, JAVA, JAVASCRIPT, P...
BROWSER SNIFFER (RENIFLEUR)
Source avec Zip DHTML SCROLLTOP

 Sources de la même categorie

Source avec Zip Source avec une capture FENETRE D'ACTUALITE par kazma
Source avec Zip Source avec une capture CLASS POP-IN AVEC EFFET SOUS JQUERY DE "CONNEXION" STYLE CS ... par Nementon
Source avec Zip Source avec une capture FENETRE DE LOGIN par kazma
Source avec Zip Source avec une capture MESSAGES VIRTUELS par grarestephane
Source avec Zip Source avec une capture ENVOIE DE MESSAGE AUTOMATIQUE par grarestephane

Commentaires et avis

Commentaire de poursame le 02/05/2005 12:32:41

bonjour ,

je suis novice en srcipte et je voudrais savoir comment faire pour utiliser ce scripte mais avec des fenetres au format bien definie ?.

Merci de l'aide que vous pourrez de donner .

Commentaire de chico200987 le 04/06/2007 17:54:37

Passe à travers IE7 ?

 Ajouter un commentaire




Nos sponsors


Sondage...

Comparez les prix

CalendriCode

Mars 2010
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

Consulter la suite du CalendriCode

 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,468 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales