字符转译 htmldecode htmlencode
htmlEncode:function (str){
var s = "";
if(str.length == 0) return "";
s = str.replace(/&/g,"&");
s = s.replace(/</g,"<");
s = s.replace(/>/g,">");
s = s.replace(/\'/g,"'");
s = s.replace(/\"/g,""");
s = s.replace(/\n\s/g," \n");
return s;
},
htmlDecode:function (str){
var s = "";
if(str.length == 0) return "";
s = str.replace(/&/g,"&");
s = s.replace(/ /g," ");
s = s.replace(/</g,"<");
s = s.replace(/>/g,">");
s = s.replace(/'/g,"\'");
s = s.replace(/"/g,"\"");
return s;
},