Use confirm method in if statement : confirm « Dialogs « JavaScript Tutorial






<html>
<head>
<script language="JavaScript" type = "text/javascript">
<!--
var username = prompt("Type your name:", "");

if (confirm("Your name is: " + username + ". Is that correct?") == true )
{
  alert("Hello " + username);
}
else
{
  alert("Hi");
}
//-->
</script>
</head>
</html>








13.2.confirm
13.2.1.Confirm dialog
13.2.2.Confirm dialog returns boolean value
13.2.3.Use Confirm dialog in if statement
13.2.4.Use confirm method in if statement