在JavaScript警告框中格式化文本 [英] format the text in javascript alert box
本文介绍了在JavaScript警告框中格式化文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在JavaScript警告框中格式化文本?我只需要在文字中加一个下划线。
解决方案
您只能使用:
\b = Backspace
\f =换页符
\\\
=换行符
\r =回车符
\ t = tab
\ 000 =八进制字符
\x00 =十六进制字符
\00000000 =十六进制Unicode字符
所以,你可以插入不同的 ASCII 字符,但不能格式化它们(如 italic 或粗体)。
编辑我也不得不提及,事实上 alert
就像 toString
转换一样,所以包括标签和/或风格是不可能的。
How can I format the text in a JavaScript alert box? I require a word in the text to be underlined.
解决方案
You can use only:
\b = Backspace
\f = Form feed
\n = New line
\r = Carriage return
\t = tab
\000 = octal character
\x00 = hexadecimal character
\u0000 = hexadecimal unicode character
So, you can insert different ASCII characters, but not format them (like italic or bold).
EDIT I also have to mention, that in fact alert
acts like toString
conversion, so including tags and/or styles is not possible.
这篇关于在JavaScript警告框中格式化文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文