Posted on: 9/16/2013 6:13:35 AM | Views : 701

hi
i have a javascript function for asp.net during keypress event for a custom textbox which only allow numbers to be enter.
this textbox have a property of decimalplace. which indicating how many decimal places the text is.
in my function
var key = window.event ? e.keyCode : e.which; var keychar = String.fromCharCode(key); var reg = null var input_value = input_value; var objdecimal = decimal; if (objdecimal > 0) { reg = new RegExp("[0-9,.]"); } else { reg = new RegExp("[0-9]"); } //if (key == 8) { // keychar = String.fromCharCode(key); //} //if (key == 13) { // key = 8;, // keychar = String.fromCharCode(key); //} return reg.test(keychar); allow user to enter number if decimal =0 if >0 then he or she will be allow to enter comma or dot. but the prob ...

Go to the complete details ...