javascript - 如何在 HTML 中制作多行警报框
问题描述
有谁知道如何在 HTML 中制作一个多行的警告框?我寻找的输出是这样的:
Rules:
1. Blah Blah Blah
2. Blah Blah Blah
3. Blah Blah Blah
[Cancel] [Ok]
到目前为止,这是javascript中的代码:
function rules() {
agree = confirm("RULES: 1. Blah Blah Blah<br> 2. Blah Blah Blah<br> 3. Blah Blah Blah<br> Press OK to agree and Cancel to Dissagree")
if (agree == true) {
alert("Thank you for agreeing to the rules!")
} else {
alert("You can not move on unless you agree to the rules.")
}
}
<button onclick="rules()">Agree to the Rules</button>
解决方案
alert("这是第一行\n这是第二行\n这是第三行");
推荐阅读
- python - Python tkinter 创建具有不同图层的图像?
- node.js - 服务器启动失败,出现“必须定义 apiKey 值!”
- python - 区域质心内的skimage
- java - 如何从 java 代码修改现有的 docker-compose 文件
- wso2 - WSO2 如何从具有相同有效负载的多个端点收集多个设备?
- android - 在 ShareIntent 上按下复制到剪贴板时的结果代码不一致
- django - 使用单个查询从 foreignKey 获取 Django 产品及其缩略图
- twilio - 如何设置 RingCentral 限制
- delphi - Delphi 无法打开数据库
- javascript - React Flash Message:如何使消息显示而不刷新页面但刷新200