I am building a web page using asp classic and populating a mdb into an html with delete button at the end of each row. When the delete button is clicked the database entry is b
Probably the easiest way would be to give each <tr>
an id based on the id of the current record then use JavaScript to post to the delete routine (which will be held in a separate ASP file), then hide the row by changing the style.display
.
<tr id="row<%= rs("recordId") %>>
<td>...</td>
<td>...</td>
<td>
<input type="button" value="Delete" OnClick="deleteRow(<%= rs("recordId") %>);"
</td>
</tr>
And the JavaScript could be something like...
var xmlhttp;
if (window.XMLHttpRequest) xmlhttp=new XMLHttpRequest(); // code for IE7+, Firefox, Chrome, Opera, Safari...
else xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5
function ajaxPage(postPage, paramList) {xmlhttp.open("POST",postPage,false);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send(paramList);return xmlhttp.responseText;}
function deleteRow(id) {
ajaxPage("deleteFunctionPage.asp", "id=" + id);
document.getElementById("row" + id).style.display = "none";
}