JS executes the judgment code before deleting

  • 2020-03-30 01:48:55
  • OfStack

A,
 
<script> 
function del(){ 
if(confirm(" Confirm deletion? ")){ 
alert("yes"); 
} 
else{ 
alert("no") 
return; 
} 
} 
</script> 
<html> 
<input type="button" value="del" onclick="del();"> 

</html> 

Second,
 
<a href='/console/oneYear.action?id=<s:property value="id" />'> The editor </a> | <a href='javascript:delMonthMessage("<s:property value="twoid" />")' onclick="return confirm(' Be sure to delete this record ?')"> delete </a> 

Three,
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> 
<title>js Confirm the delete dialog box - The lazy gallery </title> 
</head> 

<body> 
<p> 
<script language="javascript"> 
function delcfm() { 
if (!confirm(" Are you sure you want to delete? ")) { 
window.event.returnValue = false; 
} 
} 
</script> 
<a href="http://www.lanrentuku.com/" onClick="delcfm()"> delete </a></p> 
<p> Code description: it is executed after clicking the deleted hyperlink delcfm() Function. In the dialog box, if you click ok, the function returns true Value, which takes the page to <a> The linked page in the tag performs the deletion of the page; If you click cancel, the function returns false Value, <a> The TAB will not go to the page where the deletion was performed. </p> 
<p> To find more code, visit: <a href="http://www.lanrentuku.com" target="_blank"> The lazy gallery </a></p> 
</body> 
</html> 

Related articles: