【发布时间】:2019-04-05 22:29:23
【问题描述】:
有谁知道如何在 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>
我尝试使用<br>,但它们似乎没有在警告框中格式化。我得到的输出是这样的:
有谁知道如何在警告框中添加另一行?
【问题讨论】:
标签: javascript html newline alert