Fermeture auto pop up

Fermeture auto pop up - HTML/CSS - Programmation

Marsh Posté le 12-10-2003 à 21:30:19    

Bonjour,
J'ouvre des images en taille réel a partir de vignette dans un popo up en utilisant ceci :
Dans la partie Head:
<SCRIPT LANGUAGE="JavaScript">
function afficheVignette(cheminVignette,cheminMaxi)
 {
 document.write('<A HREF="javascript:afficheMaxi(\''+cheminMaxi+'\')"><IMG SRC="'+cheminVignette+'" HSPACE=0 VSPACE=0 BORDER=0 ALT="cliquez ici pour voir en grand"></A>');
 }
function afficheMaxi(chemin)
 {
 i1 = new Image;
 i1.src = chemin;
 html = '<HTML><HEAD><TITLE>Image</TITLE></HEAD><BODY LEFTMARGIN=0 MARGINWIDTH=0 TOPMARGIN=0 MARGINHEIGHT=0><CENTER><IMG SRC="'+chemin+'" BORDER=0 NAME=imageTest onLoad="window.resizeTo(document.imageTest.width+14,document.imageTest.height+32)"></CENTER></BODY></HTML>';
 popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,resizable=1');
 popupImage.document.open();
 popupImage.document.write(html);
 popupImage.document.close()
 };
</SCRIPT>
 
Dans la partie Body:
<script language="JavaScript">
afficheVignette("vignette.jpg","reel.jpg" );
</script>
 
Ma question est:
Comment fermer le popup automatiquement quand on clic sur une autre vignette ou sur la page principale ?
Merci d'avance pour toute aide

Reply

Marsh Posté le 12-10-2003 à 21:30:19   

Reply

Marsh Posté le 12-10-2003 à 21:39:34    

<body onblur="self.close();">


---------------
from here and there -- \o__________________________________ -- la révolution de la terre, en silence
Reply

Marsh Posté le 12-10-2003 à 21:56:21    

Merci pour la reponse,
Mais G deja essayé et cela ne fonctionne pas, mais je crois que cela est de ma faute, je dois mal placer : <body onblur="self.close();">
Si tu pourrais me dire ou exactement placer ce bout de code, je te serais reconnaissant, merci.

Reply

Marsh Posté le 12-10-2003 à 22:10:02    

Code :
  1. function image(chemin,text,width,height)
  2. {
  3. fenetre = window.open("", "Preview", "scrollbars=0,resizable=0,copyhistory=0,width="+width+",height="+height+", left=5,top=5" );
  4. fenetre.document.open();
  5. fenetre.document.write("<html>" );
  6. fenetre.document.write("<head><title>xxxxxxxxx:: "+text+"</title>" );
  7. fenetre.document.write("</head>" );
  8. fenetre.document.write("<body background='"+chemin+"' onBlur='top.close()'>" );
  9. fenetre.document.write("</body></html>" );
  10. fenetre.document.close();
  11. }


 
te voilà ma fonction que j'utilise  [:spamafote]


---------------
from here and there -- \o__________________________________ -- la révolution de la terre, en silence
Reply

Marsh Posté le 12-10-2003 à 22:10:27    

sinon .. postes ton code on te le debuggera ;)


---------------
from here and there -- \o__________________________________ -- la révolution de la terre, en silence
Reply

Marsh Posté le 12-10-2003 à 22:23:54    

Un grand merci a toi simogeo  :jap:  
Je savais pas que l'on pouvais avoir plusieur popupImage.document.write Donc G rajouté une ligne :
 
popupImage.document.write("<body onBlur='top.close()'>" );

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed