格式化 JavaScript 警告框中的文本 [英] Format the text in JavaScript alert box

查看:26
本文介绍了格式化 JavaScript 警告框中的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置 JavaScript 警报框中的文本格式?我需要在文本中加下划线.

How can I format the text in a JavaScript alert box? I need a word in the text to be underlined.

推荐答案

您只能使用:

 = Backspace 
f = Form feed 

 = New line 

 = Carriage return 
	 = tab
00 = octal character 
x00 = hexadecimal character 
u0000 = hexadecimal unicode character

因此,您可以插入不同的 ASCII 字符,但不能对其进行格式化(例如 斜体粗体).

So, you can insert different ASCII characters, but not format them (like italic or bold).

EDIT 我还不得不提一下,实际上 alert 的作用类似于 toString 转换,因此不可能包含标签和/或样式.

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆