代码例:
<body>
<SCRIPT LANGUAGE="JavaScript">
<!--
String.prototype.endWith=function(oString){
var reg=new RegExp(oString+"$");
return reg.test(this);
}
alert("123".endWith("3"));
//-->
</SCRIPT>
转载于:https://www.cnblogs.com/linhai/archive/2006/05/11/397683.html