Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For 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 Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 19th, 2007, 03:33 PM
Authorized User
Points: 245, Level: 4
Points: 245, Level: 4 Points: 245, Level: 4 Points: 245, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: Houston, TX, USA.
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to ricespn
Default JavaScript Confirm Box

Hi guys,

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
Reply With Quote
  #2 (permalink)  
Old January 20th, 2007, 12:48 AM
Authorized User
 
Join Date: Jan 2007
Location: , , India.
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to saurabhj Send a message via Yahoo to saurabhj
Default

Use Following code:

//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%>')">

Hope this will help...

-Saurabhj



Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript confirm box with just an 'OK' button crmpicco Javascript How-To 28 March 12th, 2014 07:44 AM
Javascript Confirm Message box itHighway Javascript How-To 5 September 25th, 2006 03:51 AM
need Confirm() with Yes/No buttons in JavaScript ehelpcornet ASP.NET 1.0 and 1.1 Basics 1 June 3rd, 2004 08:32 AM
Confirm alert box - need help, Please! larry HTML Code Clinic 1 January 25th, 2004 02:07 AM
how to default confirm box to NO in javascript. An Javascript 1 June 8th, 2003 08:34 AM



All times are GMT -4. The time now is 02:51 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.