Three ways to use JavaScript confirmation box

Source: Internet
Author: User

The three ways to use the  javascript confirmation box, often used in development, to record how to use

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.   Code as follows: <script language=javascript>  function del () {    var msg = "Are you sure you want to delete it?" NN please confirm! ";    if (Confirm (msg) ==true) {      return true;   }else{      return F alse;   } }  </SCRIPT>      Calling method:     Copy code code as follows:  <a href= "de L.php?id=123 "onclick=" Javascript:return del () "> Delete </a>      The second method: the principle is the same as above. JavaScript Delete confirmation box   code as follows: <a href= "javascript:if (Confirm (' Do you want to delete it? ') location= ' jb51.php?id= ' > Delete </a>     Third: mainly for bulk deletion of the confirmation prompt   code as follows: <input name= "Submit" type= " Submit "class=" Inputedit "value=" delete "    onclick=" {if (Confirm (' OK record? ')) {    this.document.formname.submit ();     return true;} return false;  } ">  <input name=" button "type=" buttons "id=" OK "onclick=" {if confirm (' OK delete? ') {  window.location= ' action.asp? Action=del&   tablename=item&   id=<%=id%> ';   return true; }return false;} " value= "Delete Column"/>
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

11.11 Big Sale for Cloud

Get Unbeatable Offers with up to 90% Off,Oct.24-Nov.13 (UTC+8)

Get It Now >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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: and provide relevant evidence. A staff member will contact you within 5 working days.