vla*_*ras 28
您只能使用:
\b = Backspace
\f = Form feed
\n = New line
\r = Carriage return
\t = tab
\000 = octal character
\x00 = hexadecimal character
\u0000 = hexadecimal unicode character
Run Code Online (Sandbox Code Playgroud)
因此,您可以插入不同的ASCII字符,但不能格式化它们(如斜体或粗体).
编辑我还要提一下,实际上alert
就像toString
转换一样,所以包括标签和/或样式是不可能的.
使用unicode字符为字符串加下划线'\u0332'
,称为aCOMBINING LOW LINE
function underline(s) {
var arr = s.split('');
s = arr.join('\u0332');
if (s) s = s + '\u0332';
return s;
}
var str = underline('hello world'); // "h?e?l?l?o? ?w?o?r?l?d?"
alert(str);
Run Code Online (Sandbox Code Playgroud)
不保证此方法可以产生平滑的下划线.
confirm()
在Firefox 59上的示例:
Bil*_*ell -1
这不可能。你必须使用插件。如果您安装了 jQuery,则有很多可供选择。如果不是,这个看起来很有前途:http://simplemodal.plasm.it/#examples
归档时间: |
|
查看次数: |
51557 次 |
最近记录: |