The html string constructed in the background is uploaded to the foreground string for transcoding (html) processing, and the foreground string
The knowledge lies in summary, so write down it!
For example, the background html string is
Var htmlStr = "background html string ";
Transcoding
Var html code = decodeHtml (htmlStr );
You just need to call the following js method.
Function decodeHtml (s) {var HTML_DECODE = {"& lt;": "<", "& gt;": ">", "& amp ;":"&", "& nbsp;": "", "& quot;": "\" "," & copy; ":" "// Add more }; var REGX_HTML_ENCODE =/"| & | '| <|> | [\ x00-\ x20] | [\ x7F-\ xFF] | [\ u0100-\ u2700]/g; var REGX_HTML_DECODE =/& \ w +; | & # (\ d +);/g; var REGX_TRIM =/(^ \ s *) | (\ s * $) /g; s = (s! = Undefined )? S: ""; return (typeof s! = "String ")? S: s. replace (REGX_HTML_DECODE, function ($0, $1) {var c = HTML_DECODE [$0]; if (c = undefined) {// Maybe is Entity Number if (! IsNaN ($1) {c = String. fromCharCode ($1 = 160 )? 32: $1) ;}else {c = $0 ;}} return c ;}; View Code