简体   繁体   English

用javascript编写html unicode符号

[英]Writing html unicode symbols in javascript

How do you write html code in javascript? 您如何在javascript中编写html代码?

I want to write: 我要写:

document.title = "Title " + (▴); 

where the html code is in parentheses. html代码在括号中。

Don't do it with the parentheses; 不要用括号括起来; that's invalid syntax. 那是无效的语法。 Just put it in your string and use the JavaScript Unicode syntax \? : 只需将其放在您的字符串中,然后使用JavaScript Unicode语法\?

document.title = "Title \u9652";

Here's a fiddle (note that jsFiddle won't let me change the title, so I change a div's contents instead). 这是一个小提琴 (请注意,jsFiddle不允许我更改标题,所以我改为更改div的内容)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM