i want, when i type a number in text box to format the number,
so i will get :
12345678 ==>12,345,678
i tried to use this code : http://blog.stevenlevithan.com/archives/commafy-numbers
to format number when using the keyup event.
(i tried to use code from other sources too but i get the same problem):
when i copy paste the number the code works great and the number is formated as excpected,
but when i try i get : 1,234,5,678

what am i missing?
this is one of my code test :
Code:
function FixNumberRepresentation(obj, val) {
            var str = val;
            str = str.replace(",", "");
             alert(parseInt(str).commafy());
            str = str.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
            obj.value = str;
            return false;
        }
NET CODE :
<asp:TextBox runat="server" ID="PrepaidStatus_action" Width="80px" MaxLength="11"
                                                                                            onkeyup="return FixNumberRepresentation(this,this.value)" />
                                                                                        <ajaxToolkit:FilteredTextBoxExtender ID="FilteredTextBoxExtender_PrepaidStatus_action"
                                                                                            runat="server" TargetControlID="PrepaidStatus_action" FilterType="Custom,Numbers"
                                                                                            ValidChars="," Enabled="True" />