Connecting Tech Pros Worldwide Forums | Help | Site Map

ASP in Javascript Alert Message

Newbie
 
Join Date: Feb 2006
Posts: 4
#1: Feb 3 '06
Hi everyone,

I have, what I hope, will be a simple question. I have a basic JS function to pop-up a confirm delete dialog box when deleting a record from a DB:

function confirmDelete()
{
var agree=confirm("Confirm record deletion?");
if (agree)
return true ;
else
return false ;
}

and the call in the ASP:

<a onClick='return confirmDelete();' href='deleteRecord.asp?id=" & rec("ID") & "'>

This is working perfectly. What I want to know is if there's a way to insert the rec("ID") into the JS alert message, to produce the following:

"Confirm record 1234 deletion?" or "Confirm record 9384 deletion?"

I don't know if this is even possible, but it sure would look nice! Thanks in advance!

KUB365's Avatar
Administrator
 
Join Date: Jul 2005
Location: Portland, OR
Posts: 975
#2: Feb 3 '06

re: ASP in Javascript Alert Message


Well in the URL, I see "delete.asp?id=" . So you are sending a variable via GET. It should be accessible in ASP.

Example:
Expand|Select|Wrap|Line Numbers
  1. <%
  2. id = request.querystring("id")
  3. &>
  4.  
  5. Confirm record <%=id%> for deletion?
  6.  
Newbie
 
Join Date: Feb 2006
Posts: 4
#3: Feb 8 '06

re: ASP in Javascript Alert Message


Hmmm...still not working, I guess I'll just keep messing with it. Thanks!
Newbie
 
Join Date: Jun 2006
Posts: 1
#4: Jun 29 '06

re: ASP in Javascript Alert Message


Great thread thanks
Reply