常用的js函数处理
/**
* Return a string with &, < and > replaced with their entities
*/
function escapeHtml(original) {
return original.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,''');
};
/**
* Replace common XML entities with characters
*/
function unescapeHtml(original) {
return original.replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"').replace(/'/g,"'").replace(/&/g,'&');
};
/*
* Trim() function
*/
String.prototype.Trim = function(){
return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.LTrim = function(){
return this.replace(/(^\s*)/g, "");
}
String.prototype.RTrim = function(){
return this.replace(/(\s*$)/g, "");
}