//Html structure converted to string format supports
newline
function ToHtmlString(htmlStr) {
return toTXT(htmlStr).replace(/
|rn|n/g, "
");
}
//Convert Html structure to string form for display
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;
}