A confirmation box is used to let the user make a choice. A confirmation box will appear will with an "OK" button and a "Cancel" button. Different actions will occur depending on what button the user clicks. You can specify this course of action with conditional logic. A confirmation box can be displayed using Javascript's confirm() function.
Syntax:
confirm("Text
to display in the confirmation box");
Here is a Example :
<html>
<head>
<script type="text/javascript">
function checkdelete()
{
var chk=confirm("Are you sure delete This ?");
if(chk){
return true;
}
else{
return false;
}
}
</script>
</head>
<body>
<form>
<input type="button" onclick="return checkdelete();" value="Click me for some reason" />
</form>
</body>
</html>
No comments:
Post a Comment