숫자만 입력받도록

// 숫자만 입력받는다. "-"도 받지않는다.

function fnNumberCheck(obj) 
    {
        if (/[^0-9,]/g.test(obj.value))  
        {
            var text1 = obj.value.substring(0, obj.value.length - 1);
            alert("0-9의 정수만 허용합니다.");   //이게 핵심이다. 이 alert 가 있어야 정상동작.
            obj.focus();
            obj.value = text1;
            return false;
        }
        else    
        {
            obj.value = number_format(obj.value);
        }

    }

 

<body>

<asp:TextBox ID="txtSupplyAmtFrom" OnKeyUp="fnNumberCheck(this);" runat="server" CssClass="form_input" Width="80px" MaxLength=13></asp:TextBox>
</body>

 

댓글

Designed by JB FACTORY