JavaScript的HTML解码 [英] Javascript html decoding

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

问题描述

当我在asp.net应用程序阿贾克斯收到HTML文本,它看起来像:

<$p$p><$c$c>&lt;span%20style='color:green;font-weight:bold'&gt;%20Text%20Msg&lt;/span&gt;

怎么可能在JavaScript德code文本到正常的HTML?

 &LT;跨度风格=颜色:绿;字体重量:大胆'&GT;文本消息&LT; / SPAN&GT;

谢谢!


解决方案

尼斯这里函数,会为你 - 的 http://phpjs.org/functions/htmlspecialchars_de$c$c:427

When I receive html text by ajax in asp.net application it looks like:

&lt;span%20style='color:green;font-weight:bold'&gt;%20Text%20Msg&lt;/span&gt;

how is it possible in javascript decode that text to normal html?

<span style='color:green;font-weight:bold'> Text Msg </span>

Thanks!

解决方案

Nice function here that does it for you - http://phpjs.org/functions/htmlspecialchars_decode:427

这篇关于JavaScript的HTML解码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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