boite de dialogue - ASP - Programmation
Marsh Posté le 22-10-2004 à 15:15:16
| pipouche a écrit : Bonjour,   | 
 
javascript :  
if (window.confirm('Confirmez vous la suppression ?'))      
    { 
     document.forms[monformulaire].submit(); 
    } 
Marsh Posté le 22-10-2004 à 15:33:33
Voici une partie de mon code où il y a notamment l'image clicable delete.gif. Mon problème est de savoir où insérer le bout de code. Je ne suis pas bien douée !!! 
 
<!--#include file="adovbs.inc"--> 
<!--#include file="dsn.asp"--> 
<% 
Response.Expires =0 
 
   If IsEmpty(Request.QueryString("Date" )) OR NOT IsDate(Request.QueryString("Date" )) Then 
    dDate = Date 
   Else 
    dDate = CDate(Request.QueryString("Date" )) 
   End If 
 
%> 
<html> 
 
<head> 
<title>Events for <%= FormatDateTime(dDate, 1) %></title> 
</head> 
 
<body BACKGROUND="images/image3.gif" LEFTMARGIN="5"> 
 
<p> </p> 
 
<p ALIGN="RIGHT"><img SRC="images/events.gif" WIDTH="400" HEIGHT="50" BORDER="0" ALT></p> 
 
<p><br CLEAR="ALL"> 
<% 
  ' Open a record set of schedules 
    Response.Write "<FONT COLOR='Gray' FACE='Tahoma, Verdana' SIZE=2>" & FormatDateTime(dDate, 1) & "</FONT><BR><BR>" & vbCrLf 
Set Rs = Server.CreateObject("ADODB.RecordSet" ) 
' ancienne instruction qui ne tourne pas sSQL = "SELECT * FROM tEvents " & "WHERE Start_Date <= #" & dDate & "# AND End_Date >= #" & dDate & "# ORDER BY Event_ID " 
 
     
     
    sSQL = "SELECT * FROM tEvents" 
    sSQL = sSQL & " WHERE (((year(Start_Date) < " & year(dDate) & " )" & "OR" 
    sSQL = sSQL & "((month(Start_Date) < " & month(dDate) & " )" & "AND"  
    sSQL = sSQL & "(year(Start_Date) = " & year(dDate) & " ))" & "OR" 
    sSQL = sSQL & "((day(Start_Date) <= " & day(dDate) & " )" & "AND" 
    sSQL = sSQL & "(month(Start_Date) = " & month(dDate) & " )" & "AND"  
    sSQL = sSQL & "(year(Start_Date) = " & year(dDate) & " )))" & "AND" 
    sSQL = sSQL & "((year(End_Date) > " & year(dDate) & " )" & "OR" 
    sSQL = sSQL & "((month(End_Date) > " & month(dDate) & " )" & "AND"  
    sSQL = sSQL & "(year(End_Date) = " & year(dDate) & " ))" & "OR" 
    sSQL = sSQL & "((day(End_Date) >= " & day(dDate) & " )" & "AND" 
    sSQL = sSQL & "(month(End_Date) = " & month(dDate) & " )" & "AND"  
    sSQL = sSQL & "(year(End_Date) = " & year(dDate) & " ))))"  
    sSQL = sSQL & " ORDER BY Start_Date, Event_Title DESC " 
 
  Rs.Open sSQL, sDSN, adOpenStatic, adLockReadOnly, adCmdText 
   If NOT Rs.EOF Then 
    arrColor =Array("#000000", "#CC9900", "#336600", "#FFCC66", "#0000FF", "#FF0000", "#33cc66","#cccc66","#FF3399","#FF0000","#CC3366 
" ) 
    iIndex = 0 
    
    Do While NOT Rs.EOF 
    ' Create the outer table 
    Response.Write "<TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='1' BGCOLOR='" & arrColor(iIndex) & "'><TR><TD>" & vbCrLf 
    ' Create the inner table 
    Response.Write "<TABLE WIDTH='100%' CELLSPACING=0 BORDER=0 CELLPADDING=2 BGCOLOR='White'>" & vbCrLf 
 
Select Case month(dDate) 
   Case 1 Couleur="#FFFF99" 
   Case 2 Couleur="#FFFF99" 
   Case 3 Couleur="#FFFF99" 
   Case 4 Couleur="#FFFF99" 
   Case 5 Couleur="#FFFF99" 
   Case 6 Couleur="#FFFF99" 
   Case 7 Couleur="#FFFF99" 
   Case 8 Couleur="#FFFF99" 
   Case 9 Couleur="#FFFF99" 
   Case 10 Couleur="#FFFF99" 
   Case 11 Couleur="#FFFF99" 
   Case 12 Couleur="#FFFF99" 
 End select 
 
  
 
    Response.Write "<TR BGCOLOR='" & Couleur & "'><TD HEIGHT=20 VALIGN='top'><B><FONT FACE='Verdana, Tahoma' SIZE='1' COLOR='gray'>" & vbCrLf 
    Response.Write "<FONT FACE='Verdana' SIZE=1 COLOR='#0080c0'></font face='Verdana, Tahoma' SIZE='1' COLOR='Black'>" & Rs("Intitule" ) & VbCrLf 
    Response.Write "</FONT></B> </TD>" & vbCrLf 
 
    If (Session("Admin" ) = 1 and Session("Passe" ) = Rs("Mot" )) or (Session("Admin" ) = 1 and Session("Passe" ) = "admin" ) Then 
    Response.Write "<TD align='right' HEIGHT=20 WIDTH=92 VALIGN='MIDDLE'><A HREF='addedit.asp?Event_ID=" & Rs("Event_ID" ) & "'><IMG SRC='images/edit.gif' BORDER=0 HEIGHT=20 WIDTH=90></A></TD>" & vbCrLf 
    Response.Write "<TD HEIGHT=20 WIDTH=92 ALIGN='right' VALIGN='MIDDLE'><A HREF='delete.asp?date=" & Server.URLEncode(dDate) & "&Event_ID=" & Rs("Event_ID" ) & "'><IMG SRC='images/delete.gif' BORDER=0 HEIGHT=20 WIDTH=90></A></TD>" & vbCrLf 
 
End If 
    Response.Write "</TR>" & vbCrLf
Marsh Posté le 25-10-2004 à 22:15:52
très simple, il suffit de rajouter l'évènement onclick au niveau de ton lien hypertexte. Donc pour ton code ça donnerait : 
 
| Code : 
 | 
Marsh Posté le 02-11-2004 à 14:13:38
Merci beaucoup pour ton aide. Je ne réponds que maintenant car j'étais en vacances.
Marsh Posté le 22-10-2004 à 14:41:02
Bonjour,
 
 
Je sais que l'on ne peut pas faire de boîte de dialogue en ASP.
Par contre, j'ai lu tout plein d'autres trucs qui pallient au problème mais je n'y comprend rien.
J'ai créé une appli qui gère les formations de mon entreprise.
Chaque formation apparait dans une page triée par date. Les gestionnaires peuvent à tout moment modifier une formation en cliquant sur une image qui les renvoie dans un formulaire. Ils peuvent aussi les supprimer en cliquant sur une autre image.
Je voudrais qu'un message les alerte lorsqu'ils ont cliquer sur "suppression" pour leur demander une confirmation.
Merci par avance pour votre aide.
Pipouche