<!DOCTYPE html>
<html>
<head>
<title>HTML Confirm Example</title>
<script type="text/javascript">
function showConfirm() {
// 使用 confirm 函数显示一个确认对话框
var result = confirm("你确定要继续吗?");
// 根据用户的选择执行不同的操作
if (result) {
alert("你选择了确定");
} else {
alert("你选择了取消");
}
}
</script>
</head>
<body>
<!-- 点击按钮时调用 showConfirm 函数 -->
<button onclick="showConfirm()">点击我</button>
</body>
</html>
confirm() 是 JavaScript 中的一个内置函数,用于显示一个带有 "确定" 和 "取消" 按钮的对话框。confirm() 返回 true;点击 "取消" 时返回 false。上一篇:section html
下一篇:html在线转义
Laravel PHP 深圳智简公司。版权所有©2023-2043 LaravelPHP 粤ICP备2021048745号-3
Laravel 中文站