<script type= "Text/javascript" language= "JavaScript" >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, ""); } </script><script type= "Text/javascript" language= "JavaScript" >functionTest () {varA = "abcdef". Startwith ("abc")); Alert ("A:" +a); varb = "abcdef". Endwith ("Def")); Alert ("B:" +b); } String.prototype.endWith=function(str) {if(str = =NULL|| str = = "" | | This. length = = 0 | | Str.length > This. Length)return false; if( This. SUBSTRING ( This. length-str.length) = =str)return true; Else return false; return true; } String.prototype.startWith=function(str) {if(str = =NULL|| str = = "" | | This. length = = 0 | | Str.length > This. Length)return false; if( This. substr (0, str.length) = =str)return true; Else return false; return true; }</script>