function regInput(obj, reg, inputStr) {
            if (obj.readOnly != true) {
                var docSel = document.selection.createRange();
                if (docSel.parentElement().tagName != "INPUT")
                    return false;                oSel = docSel.duplicate();
                oSel.text = "";                var srcRange = obj.createTextRange();
                oSel.setEndPoint("StartToStart", srcRange);                var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length);
                return reg.test(str);
            }
            else {
                return true;
            }
        }
        function MastInt(obj) {
            return regInput(obj, /^[0-9]*$/, String.fromCharCode(event.keyCode));
        }  <asp:TextBox ID="txt_Amount" runat="server" Width="160px" MaxLength="10" Style="ime-mode: disabled" onkeypress="return MastDecimal(this);"></asp:TextBox>
 现在只能输入整数 我要改成 只能输入整数或最多带2位小数的,一位当然也可以。 .请问下 我那个2段JS 怎么改。主要还是正则不会。