js中特殊转换字符为html标签 function htmlEncode(text){ return text.replace(/&/g,'&').replace(/"/g,'"').replace(/</g,'<').replace(/>/g,'>'); }