如何显示< Exp2:// Ticket / 18918617>在Html中 [英] How Can I Show <Exp2://Ticket/18918617> In Html

查看:59
本文介绍了如何显示< Exp2:// Ticket / 18918617>在Html中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要找到一种方式,以便我可以显示< EXP2://订票/ 18918617>在html页面中。

它无法显示上面的字符串。

任何HTML或Javascript函数来显示提到的字符串。



我添加了一个空格< EXP2://订票/ 18918617>否则它不会显示在问题本身中。



谢谢。

Need to find a way so that i could show < exp2://Ticket/18918617> in the html pages.
It is not able to show the string above.
Any HTML or Javascript function to show the string mentioned.

I have added a space < exp2://Ticket/18918617> else it will not be shown in the question itself.

Thanks.

推荐答案

你这个词重新寻找 HTML编码 [ ^ ]。



例如,该字符串应编码为:

The term you're looking for is HTML encoding[^].

For example, that string should be encoded as:
&lt;exp2://Ticket/18918617&gt;





有很多字符需要编码,所以不要尝试滚动自己的功能。大多数语言将提供编码字符串的标准方法。例如:



There are a lot of characters which need to be encoded, so don't try rolling your own function. Most languages will provide a standard method to encode a string. For example:

// Using jQuery:
function htmlEncode(value){
  return


' < div />')。text(value)。 HTML();
}

// 没有jQuery:
function htmlEncode(html){
return document .createElement(' div'
.appendChild( document .createTextNode(html))
.parentNode.innerHTML;
}
('<div/>').text(value).html(); } // Without jQuery: function htmlEncode( html ) { return document.createElement('div') .appendChild( document.createTextNode( html ) ) .parentNode.innerHTML; }



http: //stackoverflow.com/questions/1219860/html-encoding-in-javascript-jquery [ ^ ]


您必须将HTML实体代码用于特殊的html字符:
You have to use the HTML entity codes for special html characters:
&lt;exp2://Ticket/18918617&gt;





在这里你可以找到更多html实体的列表:< a href =http://dev.w3.org/html5/html-author/charref> http://dev.w3.org/html5/html-author/charref [ ^ ]


这篇关于如何显示&lt; Exp2:// Ticket / 18918617&gt;在Html中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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