Three ways to use javascript validation boxes


The first method: very good, after confirmation can open the download address page. The principle is also clearer. Mainly used to delete a single message confirmation.

<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 false;
  }
}
</SCRIPT>

Call method:

 <a href="del.php?id=123" onclick="javascript:return del()"> delete   In addition to </a>
 

Second method: the principle is the same as above. JavaScript removes the confirmation box

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

Third: mainly used for batch deletion of the confirmation prompt

<input name="Submit" type="submit" class="inputedit" value=" delete "
  onclick="{if(confirm(' Is there a record? ?')){
    this.document.formname.submit();
    return true;}return false;
  }">
<input name=" button " type="button" ID="ok" onclick="{if(confirm(' Are you sure to delete it? ?')){
  window.location='Action.asp?Action=Del&
  TableName=Item&
  ID=<%=ID%>';
  return true;
}return false;}" value=" Delete columns " />