标签:
//Html结构转字符串形式显示 支持<br>换行 function ToHtmlString(htmlStr) { return toTXT(htmlStr).replace(/\<\;br[\&ensp\;|\&emsp\;]*[\/]?\>\;|\r\n|\n/g, "<br/>"); } //Html结构转字符串形式显示 function toTXT(str) { var RexStr = /\<|\>|\"|\‘|\&| | /g str = str.replace(RexStr, function (MatchStr) { switch (MatchStr) { case "<": return "<"; break; case ">": return ">"; break; case "\"": return """; break; case "‘": return "'"; break; case "&": return "&"; break; case " ": return " "; break; case " ": return " "; break; default: break; } } ) return str; }
标签:
原文地址:http://www.cnblogs.com/snow1314/p/5853874.html