Knowledge is summed up, then write it down!
For example, the background HTML string is
var htmlstr= "background html string";
transcoding
var HTML format Code =decodehtml (HTMLSTR);
Just call the following JS method on the line
functiondecodehtml (s) {varHtml_decode = { "<": "<", ">": ">", "&": "&", " ": "", """: "\" ", "©": ""//Add More }; varRegx_html_encode =/"|&|" | <|>| [\x00-\x20]| [\x7f-\xff]| [\u0100-\u2700]/G; varRegx_html_decode =/&\w+;|&# (\d+);G; varRegx_trim =/(^\s*) | (\s*$)/G; S= (s! = undefined)? S: ""; return(typeofs! = "string")?s:s.replace (Regx_html_decode,function($ A, $) { varc = html_decode[$0]; if(c = =undefined) { //Maybe is Entity number if(!isnan ($) ) {C= String.fromCharCode (($ = = 160)? 32: $); } Else{C= $; } } returnC; }); };
View Code
Background build HTML string to foreground string transcoding (HTML) processing