Trouver une ressource (Nouvelle version du moteur, plus rapide & pertinent, essayez le !)
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 !
POPUP EN ASP
Information sur la source
Description
cette fonction affiche ou ferme un popup ENTREES : URL (adresse de la page à afficher dans le popup : optionnel) NomPopup (nom du popup : optionnel) BarreDesLiens (drapeau indiquant l'affichage ou non de la barre de liens : yes,no : optionnel, par defaut = "no") BarreDesMenus (drapeau indiquant l'affichage ou non de la barre de menu : yes,no : optionnel, par defaut = "no") BarreNav (drapeau indiquant l'affichage ou non de la barre de navigation : yes,no : optionnel, par defaut = "no") BarreDuStatut (drapeau indiquant l'affichage ou non de la barre de statut : yes,no : optionnel, par defaut = "no") ZoneAdresse (drapeau indiquant l'affichage ou non de la zone d'adresse : yes,no : optionnel, par defaut = "no") Ascenseurs (drapeau indiquant l'affichage ou non des scrollings : yes,no,auto : optionnel, par defaut = "no") Dimensionnable (drapeau indiquant si le popup est ou n'est pas redimensionnable : yes,no : optionnel, par defaut = "no") Hauteur (Hauteur du popup en pixels : nombre entier) Largeur (Largeur du popup en pixels : nombre entier) PositionH (Position horizontale en pixels sur l'écran : nombre entier : optionnel, par defaut = 0) PositionV (Position verticale en pixels sur l'écran : nombre entier : optionnel, par defaut = 0) PleinEcran (drapeau indiquant l'affichage plein écran ou non du popup : yes,no : optionnel, par defaut = "no") TitrePopup (Titre du popup : optionnel) Texte (texte à afficher dans le popup : optionnel) Choix (drapeau indiquant l'ouverture ou la fermeture du popup : "0","ouverture","yes" = ouverture, "1","fermeture","no" = fermeture) SORTIES : NEANT
Source
- 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
-
- A ceci, il faut ajouter la fonction JavaScript :
- function temporisateur(seconde,fonction) {
- setTimeout(fonction,seconde*1000);
- }
- function FermerFenetre(NomFenetre){
- if (NomFenetre.document) { NomFenetre.close(); }
- }
- qui permettent de temporiser avant la fermeture du popup
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
A ceci, il faut ajouter la fonction JavaScript :
function temporisateur(seconde,fonction) {
setTimeout(fonction,seconde*1000);
}
function FermerFenetre(NomFenetre){
if (NomFenetre.document) { NomFenetre.close(); }
}
qui permettent de temporiser avant la fermeture du popup
Conclusion
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>
Sources de la même categorie
Commentaires
Discussions en rapport avec ce code source
|
CalendriCode
| | | L | M | M | J | V | S | D |
| | | | | 1 | 2 | 3 |
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |
|
Téléchargements
Logiciels à télécharger sur le même thème :
|