Javascript 如何在警报或确认框中获取文本粗体?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5620516/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 18:05:37  来源:igfitidea点击:

How to get Text BOLD in Alert or Confirm box?

javascriptalert

提问by Warrior

How to get BOLD Text and change color of text in Alert or Confirm box?

如何在警报或确认框中获取粗体文本并更改文本颜色?

var conFrm =  confirm("Following List(s) already Sent...!\n<strong>List Name:  </strong>"+ss.replace(",","\n<b>Name: </b>")+"\n Do you want to send again...!");

采纳答案by fl00r

You can't do it. But you can use custom Alert and Confirm boxes.

你不能这样做。但是您可以使用自定义警报和确认框。

You can read about some User Interface libraries here:

您可以在此处阅读一些用户界面库:

http://speckyboy.com/2010/05/17/15-javascript-web-ui-libraries-frameworks-and-libraries/

http://speckyboy.com/2010/05/17/15-javascript-web-ui-libraries-frameworks-and-libraries/

Most common libraries are:

最常见的库是:

回答by alex

The alert()dialog is not rendered in HTML, and thus the HTML you have embedded is meaningless.

alert()对话框不是以 HTML 呈现的,因此您嵌入的 HTML 毫无意义。

You'd need to use a custom modalto achieve that.

您需要使用自定义模式来实现这一点。

回答by nulll

Maybe you coul'd use UTF8 bold chars.

也许您可以使用 UTF8 粗体字符。

For examples: https://yaytext.com/bold-italic/

例如:https: //yaytext.com/bold-italic/

It works on Chromium 80.0, I don't know on other browsers...

它适用于 Chromium 80.0,我不知道在其他浏览器上...