Classic ASP BasicsFor beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
I have an alert window that shows the action being done, but I would like to use a confirm window to to ask the user if he really want to perform that action, my question is How do I pass the value from that answer to a VBScript variable so I can then decide to perform that action or cancel it.
This is the code that I have now:
<%
if method = "DELETE" then
' Delete PL
strsql = "delete from ftx_bisi_pl where PL = '" & budel & "'"
set PLdelRS = eadoObj.SaveRecordsetQuery(CStr(strsql))
'Response.Write (strsql)
%>
<script language="JavaScript">
alert("Deleting PL successful!");
window.location="ProductionLine.asp";
</script>
<%
end if
%>
This is what I was thinking:
<script language="JavaScript">
var answer;
answer=window.confirm("Deleting PL successful!");
window.location="ProductionLine.asp";
</script>
<%
If answer then
' Delete PL
strsql = "delete from ftx_bisi_pl where PL = '" & budel & "'"
set PLdelRS = eadoObj.SaveRecordsetQuery(CStr(strsql))
'Response.Write (strsql)
end if
%>
=======================
Strange and crazy, but everything is possible
__________________
=======================
Strange and crazy, but everything is possible
//Javascript Function
<script language="Javascript">
function doDelete(id)
{
if(confirm("Are you sure want to delete this employee?"))
{
window.location.href="yourpage.asp?del="+id;
}
}
</Script>
Now you can pass the id as follow:
<input type="Button" name="delete" Value="Delete" OnClick="doDelete('<%=id%>')">