Many time while deleting a record we give one warning message or a simple window message asking the user to confirm once again the deleting process. Here the user can change his mind and can cancel the operation or confirm his action by clicking the submit button.
<script LANGUAGE="JavaScript">
<!--
function confirmSubmit(ttt,id)
{
var msg;
msg= "Are you sure you want to delete the data ? " + ttt + " - ID= "+id;
var agree=confirm(msg);
if (agree)
return true ;
else
return false ;
}
// -->
</script>
Here is the PHP code where records are displayed with a delete link. User can delete any record by clicking the delete link. Here some PHP code is shown as an example. Same way ASP or other script code can be used.
The deleting process requires server side scripting language like PHP, ASP, Perl etc. We will not discuss those here and will concentrate on JavaScript part. Here is the function which takes care of this. It takes two inputs, one is the title or the message and the other is the id of the record usually used in scripts to identify and delete the record. The confirm window will return with true or false condition. It true then the delete action will be done by the scripting angle. Here is the funciton.
Displaying Popup window → ← Window ObjectBookmark a page →Redirect Page → ← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
plus2net.com
deee
28-03-2012
Thanks, this works nicely and probably saved me a bunch of time.
✖
We use cookies to improve your browsing experience. . Learn more