NICE!
thanks,
Main Topics
Browse All Topicsgreetings,
i'm trying to write a function that i can pass a record ID to then pop a confirm box asking whether they really want to delete the record, if yes then window.location.replace the querystring w/ the id to the delete.asp page.
heres the funtion thus far. the only problem is it deletes the first record always.
<script language="JavaScript">
<!--
function confirm_entry()
{
input_box=confirm("Are you sure you want to delete this product?");
if (input_box==true)
{
// Output when OK is clicked
window.location.replace("d
}
else
{
// Output when Cancel is clicked
alert ("Delete Cancelled");
}
}
-->
</script>
heres the link they click on to delete
<a href="javascript:confirm_e
link to project http://www.luminopolis.com
and heres the full code if needed.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
<title>luminopolis store admin</title>
<META NAME="Author" CONTENT="?">
<META NAME="Keywords" CONTENT="?">
<META NAME="Description" CONTENT="?">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type='text/javascript' src='Includes/expandConten
<style type="text/css">
<!--
a:link {color:#999999;text-decora
a:visited {color:#999999;text-decora
a:hover {color:#ff9900;text-decora
a:active {color:#ff9900;text-decora
body{margin:0;padding:0;co
table,div, select, input, textarea{font-family:verda
//-->
</style>
</head>
<body>
<!-- METADATA TYPE="typelib" FILE="C:\program files\common files\system\ado\msado15.d
<CENTER><br /><br /><br />
<div style="width:800px;text-al
<table width="800">
<tr>
<td width="50%"><span style="font-size:17px;colo
<td width="50%" align="right"><img name="nav" src="Images/nav.gif" width="350" height="33" border="0" usemap="#nav" alt=""><!-- #include file="Includes/nav.asp" //--></td>
</tr>
</table><br />
<hr style="color:#000000;width
<br />
<div style="cursor:pointer;curs
<div id="sc1" class="switchcontent">
<span>
<form action="addProduct.asp" method="get" />
<input type="hidden" name="fAcctNo" value="<%=request.querystr
<table width="100%">
<tr>
<td bgcolor="#cccccc" align="right" colspan="3"> </td>
</tr>
<tr>
<td bgcolor="#ccff99" align="right"><b>Name</b>:
<td bgcolor="#e7e7e7"><input type="text" name="fProdName" value="" size="44" /></td>
<td bgcolor="#e7e7e7" style="color:#666666;">&nb
</tr>
<tr>
<td bgcolor="#ccff99" align="right"><b>Item No.</b>: </td>
<td bgcolor="#f6f6f6"><input type="text" name="fProdItemNo" value="" size="44" /></td>
<td bgcolor="#f6f6f6" style="color:#666666;">&nb
</tr>
<tr>
<td bgcolor="#ccff99" align="right"><b>Price</b>
<td bgcolor="#e7e7e7">$<input type="text" name="fProdPrice" value="" size="43" /></td>
<td bgcolor="#e7e7e7" style="color:#666666;">USD
</tr>
<tr>
<td bgcolor="#ccff99" align="right"><b>Descripti
<td bgcolor="#f6f6f6"><textare
<td bgcolor="#f6f6f6" style="color:#666666;">&nb
</tr>
<tr>
<td bgcolor="#ccff99" align="right"><b>Category<
<td bgcolor="#e7e7e7"><input type="text" name="fProdCategory" value="" size="44" /></td>
<td bgcolor="#e7e7e7" style="color:#666666;"><b>
</tr>
<tr>
<td bgcolor="#ccff99" align="right"><b>Weight</b
<td bgcolor="#f6f6f6"><input type="text" name="fProdWeight" size="44" /></td>
<td bgcolor="#f6f6f6" style="color:#666666;">&nb
</tr>
<tr>
<td bgcolor="#ccff99" align="right"><b>Options Available</b>: </td>
<td bgcolor="#e7e7e7"><textare
<td bgcolor="#e7e7e7" style="color:#666666;"><b>
</tr>
<tr>
<td bgcolor="#ccff99" align="right"><b>Handling Charge</b>: </td>
<td bgcolor="#f6f6f6">$<input type="text" name="fProdHandling" value="" size="43" /></td>
<td bgcolor="#f6f6f6" style="color:#666666;">If this product must ship in its own box or is oversized, enter the shipping amount to charge (per item bought) here.</td>
</tr>
<tr>
<td bgcolor="#ccff99" align="right"><b>Contact Override</b>: </td>
<td bgcolor="#e7e7e7"><input type="radio" name="fContactOver" value="1" /> Contact Override</td>
<td bgcolor="#e7e7e7" style="color:#666666;">If you DO NOT want this item to be ordered online and wish for the customer to call for details check this box</td>
</tr>
<tr>
<td bgcolor="#cccccc" align="right" colspan="2"><input type="submit" value="Add Item" /></td>
<td bgcolor="#cccccc"> </
</tr>
</table>
</form>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
</span>
</div>
<br /><br />
<table style="width:100%;">
<tr>
<td>
<table style="width:100%;">
<%
Dim acctNo, prodID, prodName, prodSizeColorAvail, prodDesc, prodItemNo, prodCat, prodShipHandling, C, bgColor, cat, lastCat, options, optionsF
acctNo = request.querystring("fAcct
Dim SQL, objConn, objRs
Set objConn = Server.CreateObject("ADODB
Set objRs = Server.CreateObject("ADODB
SQL = "SELECT * FROM [products] WHERE prodAcctNo = '" & acctNo & "' AND prodImgType <> '' ORDER BY prodCat"
objConn.Open "Provider=Microsoft.Jet.OL
objRs.Open SQL, objConn, adOpenForwardOnly, adLockReadOnly
%>
<script language="JavaScript">
<!--
function confirm_entry()
{
input_box=confirm("Are you sure you want to delete this product?");
if (input_box==true)
{
// Output when OK is clicked
window.location.replace("d
}
else
{
// Output when Cancel is clicked
alert ("Delete Cancelled");
}
}
-->
</script>
<%
If objRs.eof then
response.write "<tr><td colspan='3'>NO RESULTS FOUND</td></tr>"
else
While Not objRs.EOF
cat = objRs("prodCat")
If C Mod 2 = 0 Then
isEven = True
Else
isEven = False
End If
If isEven = False Then
bgColor = "e7e7e7"
Else
bgColor = "f6f6f6"
End If
%>
<tr>
<TD colspan="3" align="right">
<%
If cat = lastCat then
%>
<%
else
%>
<span style="font-size:17px;font
<%
end if
%>
</td>
</tr>
<tr bgColor="<%=bgColor%>" onmouseover="this.bgColor=
<td align="center"><input type="hidden" name="fProdID" value="<%=objRs("prodID")%
<td style="padding:5;">
<b><%=objRs("prodName")%><
<%=objRs("prodDesc")%><br /><br />
<b>$</b><%=objRs("prodPric
<b>Options:</b> <% if objRs("prodSizeColorAvail"
<b>#</b> <%=objRs("prodItemNo")%><b
<b>Category:</b> <%=objRs("prodCat")%><br />
<b>Handling Charge:</b> <%=objRs("prodShipHandling
<b>Contact Override</b> <%if objRs("prodContactOverride
<td align="center"><a href="javascript:confirm_e
</tr>
<%
lastCat = objRs("prodCat")
C = C + 1
objRs.MoveNext
Wend
End If
objRs.Close
objConn.Close
Set objRs = Nothing
Set objConn = Nothing
%>
</table>
</td>
</tr>
</table>
<br /><br /><hr style='color:#000000;width
<br /><br /><br />
<center><!-- #include file="Includes/bNav.asp" //--><br /><br /></center>
</body>
</html>
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: dorwardPosted on 2005-07-28 at 12:47:21ID: 14549331
Much simpler way:
rodID=<%=o bjRs("prod ID")%>&fAc ctNo=<%=re quest.quer ystring("f AcctNo")%> " " border="0" alt="Delete"></a>
<a href="deleteProduct.asp?fP
onclick="return confirm('Really delete?');"><img src="Images/btn_delete.gif