The usage example of confirm is used to determine if a button operation is to be performed

  • 2020-03-30 03:24:58
  • OfStack

<script type = "text/javascript" language = "javascript"> 
function clear1() { 
if(confirm(" Are you sure you want to empty the data? ")) { 
document.main.text1.value = ""; }
} 
</script>
<body>
<form name="main"> 
<input type="text" name="text1" /> 
<input type="button" name="Submit" value=" Empty data " onClick="return clear1();">
</form>
</body>

Related articles: