截取abcdefg右边的fg
方法一
<script> <BR>string="abcdefg" <BR>alert(string.substring(string.length-2,string.length)) <BR></script>
方法2
<script> <BR>alert("abcdefg".match(/.*(.{2})/)[1]) <BR></script>
<script> <BR>alert("abcdefg".match(/.{2}$/)) <BR></script>
方法3
<script> <BR>alert("abcdefg".slice(-2)) <FONT style="BACKGROUND-COLOR: #ccffcc"> //推荐这个,比较简单,-2表示取右边两个字符<BR></script>