Deprecated: Typecho\Widget\Request::getServer(): Implicitly marking parameter $default as nullable is deprecated, the explicit nullable type must be used instead in D:\PHP_HOME\www\gp_blog\var\Typecho\Widget\Request.php on line 219

Deprecated: Typecho\Request::getServer(): Implicitly marking parameter $default as nullable is deprecated, the explicit nullable type must be used instead in D:\PHP_HOME\www\gp_blog\var\Typecho\Request.php on line 349

Deprecated: Typecho\Widget\Response::goBack(): Implicitly marking parameter $suffix as nullable is deprecated, the explicit nullable type must be used instead in D:\PHP_HOME\www\gp_blog\var\Typecho\Widget\Response.php on line 158

Deprecated: Typecho\Widget\Response::goBack(): Implicitly marking parameter $default as nullable is deprecated, the explicit nullable type must be used instead in D:\PHP_HOME\www\gp_blog\var\Typecho\Widget\Response.php on line 158
javascript中confirm用法是什么 - 开发者

在JavaScript中,confirm()方法用于显示一个指定消息和带有确定和取消的对话框,语法为“confirm(在对话框上显示的文本)”,当点击“确定”按钮时会返回true,点击“取消”按钮则会返回false。

javascript中confirm用法是什么
此方法是JavaScript的原生方法,用于显示一个指定消息和带有确定和取消的对话框(显示方式与alert()效果类似),当点击确定(或点击回车键)按钮时,会返回true,点击取消(或ESC键)则会返回false

<button id="cfm">Confirm测试</button>
<script>
document.getElementById('cfm').onclick = () => {        
 var test = confirm('测试');
 console.log(test)
}
</script>

2022-11-25T06:32:43.png

标签: none

评论已关闭