Rien de bien compliqué!
Vous pouvez modifier le temps de temporisation de fermeture du popup
Comme vous le voyez, vous pouvez ouvrir un popup par défaut, ayant les atttributs par défaut sinon, appelez la fonction Popup avec tous les paramètres que vous voulez!
Voici une page asp exemple :
<%
function PopUp(URL,NomPopup,BarreDesLiens,BarreDesMenus,BarreNav,BarreDuStatut,ZoneAdresse,Ascenseurs,Dimensionnable,Hhauteur,Largeur,PositionH,PositionV,PleinEcran,TitrePopup,Texte,Choix)
Dim strRetour,sep
sep = " "
if (BarreDesLiens="") then BarreDesLiens="no" end if
if (BarreDesMenus="") then BarreDesMenus="no" end if
if (BarreNav="") then BarreNav="no" end if
if (BarreDuStatut="") then BarreDuStatut="no" end if
if (ZoneAdresse="") then ZoneAdresse="no" end if
if (Ascenseurs="") then Ascenseurs="no" end if
if (Dimensionnable="") then Dimensionnable="no" end if
if (Hhauteur="") then Hhauteur="100" end if
if (Largeur="") then Largeur="250" end if
if (PositionH="") then PositionH="100" end if
if (PositionV="") then PositionV="200" end if
if (PleinEcran="") then PleinEcran="no" end if
strRetour = "<script language=""JavaScript"">" & vbcrlf
strRetour = strRetour & sep & "var w;" & vbcrlf
SELECT CASE LCase(Choix)
CASE "o","ouverture","yes","0","open"
strRetour = strRetour & sep & "w = window.open ("""&URL&""",'"&NomPopup&"','directories="&BarreDesLiens&",menubar="&BarreDesMenus&",toolbar="&BarreNav&",status="&BarreDuStatut&",location="&ZoneAdresse&",scrollbars="&Ascenseurs&",resizable="&Dimensionnable&",height="&Hhauteur&",width="&Largeur&",top="&PositionV&",left="&PositionH&",fullscreen="&PleinEcran&"');" & vbcrlf
strRetour = strRetour & sep & "w.document.write(""<html>"");" & vbcrlf
IF TitrePopup <> "" THEN
strRetour = strRetour & sep & "w.document.write(""<TITLE>"&TitrePopup&"</TITLE>"");" & vbcrlf
END IF
strRetour = strRetour & sep & "w.document.write(""<body>"");" & vbcrlf
IF Texte <> "" THEN
strRetour = strRetour & sep & "w.document.write(""<div align=center>"&Texte&"</div>"");" & vbcrlf
END IF
strRetour = strRetour & sep & "w.document.write(""<br>"");" & vbcrlf
strRetour = strRetour & sep & "w.document.write(""<div align=center><a href='javascript:self.close();'>fermer</a></div>"");" & vbcrlf
strRetour = strRetour & sep & "w.document.write(""</body>"");" & vbcrlf
strRetour = strRetour & sep & "w.document.write(""</html>"");" & vbcrlf
CASE "n","fermeture","no","1","close"
' temporisation
strRetour = strRetour & sep & "temporisateur(1,""FermerFenetre(w)"");" & vbcrlf
END SELECT
strRetour = strRetour & "</script>" & vbcrlf
response.write(strRetour)
end function
function PopupSimple(URL,NomPopup,Hhauteur,Largeur,TitrePopup,Texte,Choix)
PopupSimple = PopUp(URL,NomPopup,"","","","","","","",Hhauteur,Largeur,"","","",TitrePopup,Texte,Choix)
end function
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Acceuil</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script language="JavaScript">
<!--
function temporisateur(seconde,fonction) {
setTimeout(fonction,seconde*1000);
}
function FermerFenetre(NomFenetre){
if (NomFenetre.document) { NomFenetre.close(); }
}
//-->
</script>
</HEAD>
<BODY>
<%
call PopupSimple("","Test","150","300","Ceci est un test","Bonjour toua!","0")
call PopupSimple("","Test","","","","","1")
%>
</BODY>
</HTML>