代码示例:(标识:jsck_confirm_1)
<!DOCTYPE html>
<html>
<body>

<h1>Window 对象</h1>

<h2>confirm() 方法</h2>

<p>单击该按钮可显示确认框。</p>

<button onclick="myFunction()">试一试</button>

<script>
function myFunction() {
  confirm("请按按钮!");
}
</script>

</body>
</html>
运行结果: