3 Kinds of Delete confirm JS code __JS

Source: Internet
Author: User

The first method: very useful, confirm to open the Download Address page. The principle is also quite clear. Mainly used to delete a single message confirmation.


<script language=javascript>
function P_del () {
var msg = "Are you really sure you want to delete it?" Please confirm. \ n ";
if (Confirm (msg) ==true) {
return true;
}else{
return false;
}
}
</SCRIPT>
Call Method:
<a href= "del.jsp?id=<%=id%>" onclick= "Javascript:return P_del ()" > Delete </a>

The second method: the principle is the same as above. JavaScript Delete Confirmation Box

<a href= "javascript:if (' Do you really want to delete it? ') location= ' jb51.php?id= ' > Delete </a>

The third type: the confirmation prompt that is mainly used for bulk deletion
<input name= "Submit" type= "Submit" class= "Inputedit" value= "delete" onclick= "{if confirm (' OK record? ') {this.document.formname.submit (); return true;} return false;} " >

<input name= "Buttons" type= "button" id= "OK" onclick= "{if" (' OK delete? ') {window.location= ' action.asp? Action=del&tablename=item&id=<%=id%> '; return true;} return false;} " value= "Delete Column"/>

The following are the other netizens sorted, very similar. It is generally through the pop-up confirmation button to determine whether to continue to enter the following delete page.
First type:
<a href= "javascript:if (Confirm (' Confirm deletion? ')) window.location= ' del.asp ' > Delete </a>
The second type:
<script language= "JavaScript" >
<!--
function Del_sure () {
var gnl=confirm ("Are you really sure you want to delete it?");
if (gnl==true) {
return true;
}
else{
return false;
}
}
--->
</script>
Call
<a href= "del.asp?id=<%=rs (" id ")%>" onclick= "Javascript:del_sure ()" > Delete </a>
The third type:
<script language= "JavaScript" >
function Confirmdel (str) {
return confirm (str);
}
</script>
<a href= "delete.asp" onclick= "return Confirmdel (' OK to delete ')" > Delete </a>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.