截取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>