js弹出消息对话框的几种方式

js弹出消息对话框的几种方式

  • 在script标签下
方法名 作用
console.log('message') 写入控制台,按f12在Console中查看
alert('message') 直接弹出,有确定按钮,无取消按钮
confirm('message') 直接弹出,有确定按钮,有取消按钮
prompt('message') 弹出输入框
document.write('message') 未知
  • confirm:根据你的点击,返回值只能为True,或是False
    • 如果是true会继续执行绑定的事件
    • 如果是false,会阻止执行绑定事件,
posted @ 2019-08-18 18:53  abcde_12345  阅读(4589)  评论(0编辑  收藏  举报