SOURCE

console 命令行工具 X clear

                    
>
console
function show_confirm()
{
var r=confirm("Press a button!");
if (r==true)
  {
  alert("You pressed OK!");
  }
else
  {
  alert("You pressed Cancel!");
  }
}
<input type="button" onclick="show_confirm()" value="Show a confirm box">