Sunday, June 8, 2008

Only enter integer value in textbox with javascript

Here the code how its work
create one php file as numberonly.php

write function into your javascript file
function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode
if (charCode > 31 && (charCode <> 57))
return false;
return true; }

put this function into textbox onkeypress event.
input type=text onkeypress=return isNumberKey(this.value)
Enjoy.. you will get the result.

No comments: